Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

950 B
Raw Blame
import type { z } from 'zod';

export class SkillParseError extends Error {
  cause?: Error;

  constructor(message: string, cause?: Error) {
    super(message);
    this.name = 'SkillParseError';
    this.cause = cause;
  }
}

export class SkillManifestError extends Error {
  zodError?: z.ZodError;

  constructor(message: string, zodError?: z.ZodError) {
    super(message);
    this.name = 'SkillManifestError';
    this.zodError = zodError;
  }
}

export class SkillResourceError extends Error {
  constructor(message: string) {
    super(message);
    this.name = 'SkillResourceError';
  }
}

export class SkillImportError extends Error {
  constructor(
    message: string,
    readonly code:
      | 'CONFLICT'
      | 'INVALID_URL'
      | 'NOT_FOUND'
      | 'DOWNLOAD_FAILED'
      | 'FILE_NOT_FOUND'
      | 'FORBIDDEN'
      | 'CONNECT_GITHUB'
      | 'GITHUB_ACCESS',
  ) {
    super(message);
    this.name = 'SkillImportError';
  }
}