From 58e446d999a8fec76e8f3cf3fb9cc77f96ea293e Mon Sep 17 00:00:00 2001 From: Fulmine Date: Tue, 1 Mar 2022 11:32:05 +0100 Subject: [PATCH] fix(?): don't parse data twice --- src/api/errors.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/errors.ts b/src/api/errors.ts index 7c5aad7c..c6b4ff70 100644 --- a/src/api/errors.ts +++ b/src/api/errors.ts @@ -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; }