Don't throw in array/dict conversion

This commit is contained in:
Cohee
2024-09-01 11:44:56 +03:00
parent bc65c5b7e7
commit 5563d49184

View File

@ -79,7 +79,8 @@ export function convertValueType(value, type) {
if (Array.isArray(parsedArray)) { if (Array.isArray(parsedArray)) {
return parsedArray; return parsedArray;
} }
throw new Error('Value is not an array.'); // The value is not an array
return [];
} catch { } catch {
return []; return [];
} }
@ -92,7 +93,8 @@ export function convertValueType(value, type) {
if (typeof parsedObject === 'object') { if (typeof parsedObject === 'object') {
return parsedObject; return parsedObject;
} }
throw new Error('Value is not an object.'); // The value is not an object
return {};
} catch { } catch {
return {}; return {};
} }