mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
fix(?): don't parse data twice
This commit is contained in:
parent
33ee82efa4
commit
58e446d999
1 changed files with 2 additions and 2 deletions
|
|
@ -12,14 +12,14 @@ interface ApiError {
|
|||
data?: any,
|
||||
}
|
||||
|
||||
export function parse(code: number, data?: string): ApiError {
|
||||
export function parse(code: number, data?: any): ApiError {
|
||||
var type = ErrorType[ErrorType[code]] ?? ErrorType.Unknown;
|
||||
if (code >= 500) type = ErrorType.InternalServerError;
|
||||
|
||||
var err: ApiError = { code, type };
|
||||
|
||||
if (data) {
|
||||
var d = JSON.parse(data);
|
||||
var d = data;
|
||||
err.message = d.message;
|
||||
err.data = d;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue