From 34d4d606c305ffa81942f5c8a320cceff097ca14 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Mon, 17 Jun 2024 22:45:05 -0400 Subject: [PATCH] tweak: add more information to errors --- packages/backend/src/routers/share.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/routers/share.js b/packages/backend/src/routers/share.js index d725e7d3..8827212d 100644 --- a/packages/backend/src/routers/share.js +++ b/packages/backend/src/routers/share.js @@ -300,7 +300,8 @@ const v0_2 = async (req, res) => { item.invalid = true; result.recipients[item.i] = APIError.create('future', null, { - what: 'specifying recipients by email' + what: 'specifying recipients by email', + value: item.value }); continue; } @@ -354,7 +355,10 @@ const v0_2 = async (req, res) => { if ( whatis(value) !== 'object' ) { item.invalid = true; result.paths[i] = - APIError.create('invalid_path', null, { value }); + APIError.create('invalid_path', null, { + path: item.path, + value, + }); continue; } @@ -372,7 +376,10 @@ const v0_2 = async (req, res) => { if ( errors.length ) { item.invalid = true; result.paths[item.i] = - APIError.create('field_errors', null, { errors }); + APIError.create('field_errors', null, { + path: item.path, + errors + }); continue; } @@ -389,7 +396,9 @@ const v0_2 = async (req, res) => { if ( ! await node.exists() ) { item.invalid = true; - result.paths[item.i] = APIError.create('subject_does_not_exist') + result.paths[item.i] = APIError.create('subject_does_not_exist', { + path: item.path, + }) continue; }