mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-22 10:15:31 -04:00
d9bf30fc22
Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com>
184 lines
4.4 KiB
TypeScript
184 lines
4.4 KiB
TypeScript
import { Schema } from "effect"
|
|
|
|
export class InvalidRequestError extends Schema.TaggedErrorClass<InvalidRequestError>()(
|
|
"InvalidRequestError",
|
|
{
|
|
message: Schema.String,
|
|
kind: Schema.optional(Schema.String),
|
|
field: Schema.optional(Schema.String),
|
|
},
|
|
{ httpApiStatus: 400 },
|
|
) {}
|
|
|
|
export class UnauthorizedError extends Schema.TaggedErrorClass<UnauthorizedError>()(
|
|
"UnauthorizedError",
|
|
{ message: Schema.String },
|
|
{ httpApiStatus: 401 },
|
|
) {}
|
|
|
|
export class ConflictError extends Schema.TaggedErrorClass<ConflictError>()(
|
|
"ConflictError",
|
|
{
|
|
message: Schema.String,
|
|
resource: Schema.optional(Schema.String),
|
|
},
|
|
{ httpApiStatus: 409 },
|
|
) {}
|
|
|
|
export class SessionBusyError extends Schema.TaggedErrorClass<SessionBusyError>()(
|
|
"SessionBusyError",
|
|
{
|
|
sessionID: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 409 },
|
|
) {}
|
|
|
|
export class ServiceUnavailableError extends Schema.TaggedErrorClass<ServiceUnavailableError>()(
|
|
"ServiceUnavailableError",
|
|
{
|
|
message: Schema.String,
|
|
service: Schema.optional(Schema.String),
|
|
},
|
|
{ httpApiStatus: 503 },
|
|
) {}
|
|
|
|
export class UnknownError extends Schema.TaggedErrorClass<UnknownError>()(
|
|
"UnknownError",
|
|
{
|
|
message: Schema.String,
|
|
ref: Schema.optional(Schema.String),
|
|
},
|
|
{ httpApiStatus: 500 },
|
|
) {}
|
|
|
|
export class ProviderNotFoundError extends Schema.TaggedErrorClass<ProviderNotFoundError>()(
|
|
"ProviderNotFoundError",
|
|
{
|
|
providerID: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|
|
|
|
export class SessionNotFoundError extends Schema.TaggedErrorClass<SessionNotFoundError>()(
|
|
"SessionNotFoundError",
|
|
{
|
|
sessionID: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|
|
|
|
export class MessageNotFoundError extends Schema.TaggedErrorClass<MessageNotFoundError>()(
|
|
"MessageNotFoundError",
|
|
{
|
|
sessionID: Schema.String,
|
|
messageID: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|
|
|
|
export class SkillNotFoundError extends Schema.TaggedErrorClass<SkillNotFoundError>()(
|
|
"SkillNotFoundError",
|
|
{
|
|
skill: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|
|
|
|
export class CommandNotFoundError extends Schema.TaggedErrorClass<CommandNotFoundError>()(
|
|
"CommandNotFoundError",
|
|
{
|
|
command: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|
|
|
|
export class CommandEvaluationError extends Schema.TaggedErrorClass<CommandEvaluationError>()(
|
|
"CommandEvaluationError",
|
|
{
|
|
command: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 500 },
|
|
) {}
|
|
|
|
export class InvalidCursorError extends Schema.TaggedErrorClass<InvalidCursorError>()(
|
|
"InvalidCursorError",
|
|
{ message: Schema.String },
|
|
{ httpApiStatus: 400 },
|
|
) {}
|
|
|
|
export class PermissionNotFoundError extends Schema.TaggedErrorClass<PermissionNotFoundError>()(
|
|
"PermissionNotFoundError",
|
|
{
|
|
requestID: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|
|
|
|
export class QuestionNotFoundError extends Schema.TaggedErrorClass<QuestionNotFoundError>()(
|
|
"QuestionNotFoundError",
|
|
{
|
|
requestID: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|
|
|
|
export class FormNotFoundError extends Schema.TaggedErrorClass<FormNotFoundError>()(
|
|
"FormNotFoundError",
|
|
{
|
|
id: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|
|
|
|
export class FormAlreadySettledError extends Schema.TaggedErrorClass<FormAlreadySettledError>()(
|
|
"FormAlreadySettledError",
|
|
{
|
|
id: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 409 },
|
|
) {}
|
|
|
|
export class FormInvalidAnswerError extends Schema.TaggedErrorClass<FormInvalidAnswerError>()(
|
|
"FormInvalidAnswerError",
|
|
{
|
|
id: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 400 },
|
|
) {}
|
|
|
|
export class ForbiddenError extends Schema.TaggedErrorClass<ForbiddenError>()(
|
|
"ForbiddenError",
|
|
{ message: Schema.String },
|
|
{ httpApiStatus: 403 },
|
|
) {}
|
|
|
|
export class PtyNotFoundError extends Schema.TaggedErrorClass<PtyNotFoundError>()(
|
|
"PtyNotFoundError",
|
|
{
|
|
ptyID: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|
|
|
|
export class ShellNotFoundError extends Schema.TaggedErrorClass<ShellNotFoundError>()(
|
|
"ShellNotFoundError",
|
|
{
|
|
id: Schema.String,
|
|
message: Schema.String,
|
|
},
|
|
{ httpApiStatus: 404 },
|
|
) {}
|