We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca5af25 commit 18e8650Copy full SHA for 18e8650
adminforth/modules/restApi.ts
@@ -748,10 +748,12 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
748
},
749
adminforth: this.adminforth,
750
});
751
- if (!resp || (!resp.ok && !resp.error)) {
752
- throw new Error(`Hook must return object with {ok: true} or { error: 'Error' } `);
+ if (!resp || typeof resp.ok !== 'boolean') {
+ throw new Error(`Hook beforeSave must return { ok: boolean, error?: string | null }`);
753
+ }
754
+ if (resp.ok === false && !resp.error) {
755
+ return { error: resp.error ?? 'Operation aborted by hook' };
756
}
-
757
if (resp.error) {
758
return { error: resp.error };
759
0 commit comments