export class ExecutionNotAllowed
extends Schema.TaggedError<ExecutionNotAllowed>()('ExecutionNotAllowed', {
message: Schema.String,
}, HttpApiSchema.annotations({ status: 400 }))
{}
const ExecutorApiLive = HttpApiBuilder
.group(
apiSpec,
'theGroup',
handlers =>
handlers
.handle(
'endpoint',
Effect.fn('handlers.endpoint')(function*({ payload }) {
return yield* whatever(payload)
.pipe(
Effect.map(() => ({ status: 'ok' as const })),
Effect.catchTag('ExecutionRejected', () =>
ExecutionNotAllowed
.make({
message: 'Not allowed',
})),
)
}),
),
)
export class ExecutionNotAllowed
extends Schema.TaggedError<ExecutionNotAllowed>()('ExecutionNotAllowed', {
message: Schema.String,
}, HttpApiSchema.annotations({ status: 400 }))
{}
const ExecutorApiLive = HttpApiBuilder
.group(
apiSpec,
'theGroup',
handlers =>
handlers
.handle(
'endpoint',
Effect.fn('handlers.endpoint')(function*({ payload }) {
return yield* whatever(payload)
.pipe(
Effect.map(() => ({ status: 'ok' as const })),
Effect.catchTag('ExecutionRejected', () =>
ExecutionNotAllowed
.make({
message: 'Not allowed',
})),
)
}),
),
)