feature: file uploading
This commit is contained in:
parent
a144c88c17
commit
ffe0678e5b
8 changed files with 388 additions and 13 deletions
|
@ -1,3 +1,18 @@
|
|||
export function unknown(error?: Error): Response {
|
||||
if (Deno.env.get('TRACE_ERROR_RESPONSES')) {
|
||||
console.trace(error ?? 'unknown error');
|
||||
}
|
||||
return Response.json({
|
||||
error: {
|
||||
message: error?.message ?? 'Unknown Error',
|
||||
cause: error?.cause ?? 'unknown_error',
|
||||
stack: Deno.env.get('TRACE_ERROR_RESPONSES') ? error?.stack ?? '' : null
|
||||
}
|
||||
}, {
|
||||
status: 500
|
||||
});
|
||||
}
|
||||
|
||||
export function not_found(): Response {
|
||||
if (Deno.env.get('TRACE_ERROR_RESPONSES')) {
|
||||
console.trace('not_found');
|
||||
|
@ -12,6 +27,20 @@ export function not_found(): Response {
|
|||
});
|
||||
}
|
||||
|
||||
export function conflict(): Response {
|
||||
if (Deno.env.get('TRACE_ERROR_RESPONSES')) {
|
||||
console.trace('conflict');
|
||||
}
|
||||
return Response.json({
|
||||
error: {
|
||||
message: 'Conflict - this resource already exists.',
|
||||
cause: 'conflict'
|
||||
}
|
||||
}, {
|
||||
status: 409
|
||||
});
|
||||
}
|
||||
|
||||
export function permission_denied(): Response {
|
||||
if (Deno.env.get('TRACE_ERROR_RESPONSES')) {
|
||||
console.trace('permission_denied');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue