MediaService: Add MediaBackendError

This get's thrown when the backend can't perform the required action.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-02-25 13:51:54 +01:00 committed by David Mehren
parent df1ae4d512
commit 8515d824b7
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
3 changed files with 11 additions and 0 deletions

View file

@ -11,6 +11,7 @@ export interface MediaBackend {
* Saves a file according to backend internals.
* @param buffer File data
* @param fileName Name of the file to save. Can include a file extension.
* @throws {MediaBackendError} - there was an error saving the file
* @return Tuple of file URL and internal backend data, which should be saved.
*/
saveFile(buffer: Buffer, fileName: string): Promise<[string, BackendData]>;
@ -19,6 +20,7 @@ export interface MediaBackend {
* Retrieve the URL of a previously saved file.
* @param fileName String to identify the file
* @param backendData Internal backend data
* @throws {MediaBackendError} - there was an error deleting the file
*/
getFileURL(fileName: string, backendData: BackendData): Promise<string>;
@ -26,6 +28,7 @@ export interface MediaBackend {
* Delete a file from the backend
* @param fileName String to identify the file
* @param backendData Internal backend data
* @throws {MediaBackendError} - there was an error retrieving the url
*/
deleteFile(fileName: string, backendData: BackendData): Promise<void>;
}