[feature-274] the script for download and verify oculus game works

This commit is contained in:
MathieuG-P
2023-10-02 13:04:28 +02:00
parent 90ef3532b4
commit 3afeeef848
6 changed files with 282 additions and 11 deletions
@@ -0,0 +1,25 @@
export class CustomError extends Error {
private readonly _code: string;
private readonly _data?: unknown;
constructor(message: string, code: string, data?: unknown){
super(message);
this._code = code;
this._data = data;
}
public get code(): string { return this._code; }
public get data(): unknown { return this._data; }
public static fromError(error: Error, code: string, data?: unknown): CustomError{
const customError = new CustomError(error.message ?? error.toString(), code, data);
customError.stack = error.stack;
return customError;
}
public static throw(error: Error, code: string, data?: unknown): never{
throw CustomError.fromError(error, code, data);
}
}