adjust frontend to new backend
This commit is contained in:
15
templates/api/exception.mustache
Normal file
15
templates/api/exception.mustache
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Represents an error caused by an api call i.e. it has attributes for a HTTP status code
|
||||
* and the returned body object.
|
||||
*
|
||||
* Example
|
||||
* API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299]
|
||||
* => ApiException(404, someErrorMessageObject)
|
||||
*
|
||||
*/
|
||||
export class ApiException<T> extends Error {
|
||||
public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) {
|
||||
super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " +
|
||||
JSON.stringify(headers))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user