- added own provider for drive methods
Some checks failed
CI Pipeline / japa-tests (push) Failing after 1m13s
Some checks failed
CI Pipeline / japa-tests (push) Failing after 1m13s
- renamed middleware Role and Can to role_middleware and can_middleware - added some typing for inertia vue3 components - npm updates
This commit is contained in:
parent
cb51a4136f
commit
296c8fd46e
67 changed files with 2515 additions and 1913 deletions
73
providers/drive/exceptions/index.ts
Normal file
73
providers/drive/exceptions/index.ts
Normal file
|
@ -0,0 +1,73 @@
|
|||
// const utils_1 = require("@poppinss/utils");
|
||||
// import * as utils_1 from "@poppinss/utils";
|
||||
import { Exception } from '@poppinss/utils';
|
||||
|
||||
/**
|
||||
* Custom exception for when a file cannot be deleted from a specified location
|
||||
*/
|
||||
export class CannotDeleteFileException extends Exception {
|
||||
location: string;
|
||||
original: any;
|
||||
|
||||
static invoke(location: string, original: any): CannotDeleteFileException {
|
||||
const error = new this(`Cannot delete file at location "${location}"`, {
|
||||
code: 'E_CANNOT_DELETE_FILE',
|
||||
status: 500,
|
||||
});
|
||||
error.location = location;
|
||||
error.original = original;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom exception for when file metadata cannot be retrieved
|
||||
*/
|
||||
export class CannotGetMetaDataException extends Exception {
|
||||
location: string;
|
||||
operation: string;
|
||||
original: any;
|
||||
|
||||
static invoke(location: string, operation: string, original: any): CannotGetMetaDataException {
|
||||
const error = new this(`Unable to retrieve the "${operation}" for file at location "${location}"`, {
|
||||
code: 'E_CANNOT_GET_METADATA',
|
||||
status: 500,
|
||||
});
|
||||
error.location = location;
|
||||
error.operation = operation;
|
||||
error.original = original;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given location is trying to traverse beyond the root path
|
||||
*/
|
||||
export class PathTraversalDetectedException extends Exception {
|
||||
location: string;
|
||||
static invoke(location: string) {
|
||||
const error = new this(`Path traversal detected: "${location}"`, {
|
||||
code: 'E_PATH_TRAVERSAL_DETECTED',
|
||||
status: 500,
|
||||
});
|
||||
error.location = location;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unable to list directory contents of given location
|
||||
*/
|
||||
export class CannotListDirectoryException extends Exception {
|
||||
location: string;
|
||||
original: any;
|
||||
static invoke(location: string, original: any): CannotListDirectoryException {
|
||||
const error = new this(`Cannot list directory contents of location "${location}"`, {
|
||||
status: 500,
|
||||
code: 'E_CANNOT_LIST_DIRECTORY',
|
||||
});
|
||||
error.location = location;
|
||||
error.original = original;
|
||||
return error;
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue