You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarify that OdxError.code is the JSON-RPC code (not HTTP status),
note caller-initiated aborts propagate unwrapped, and that
call_method's MissingFnNameError is a rejected promise.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+10-3Lines changed: 10 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,19 +182,21 @@ Each data function also accepts an optional trailing `opts?: OdxRequestOptions`
182
182
Every failure is **thrown** as a typed error — proxy-level failures (non-2xx) *and* Odoo logic errors (an `error` body on a `200`). On success the helper resolves to the envelope with `result` set. Use a single `try/catch`:
else { throwerr; } // not from this SDK (e.g. a caller-initiated AbortError) — propagate
194
196
}
195
197
```
196
198
197
-
All errors extend `OdxError` and carry the JSON-RPC `code`, `message`, `data`, and the raw `httpStatus`. Subclasses map to the proxy's error catalog:
199
+
All errors extend `OdxError` and carry the JSON-RPC `code`, `message`, `data`, and the raw `httpStatus`. Note that `code` is the **JSON-RPC code** (the values below), *not* the HTTP status — that's on `httpStatus`. Subclasses map to the proxy's error catalog:
198
200
199
201
| Class | code | When |
200
202
|---|---|---|
@@ -207,6 +209,11 @@ All errors extend `OdxError` and carry the JSON-RPC `code`, `message`, `data`, a
|`OdooLogicError`|*Odoo's code*| Odoo-side logic error returned on a 200 |
209
211
212
+
Two behaviors worth knowing:
213
+
214
+
-**Caller-initiated aborts are not wrapped.** If you pass your own `opts.signal` and abort it, the original `AbortError` propagates unchanged — only the client's *own* timeout becomes an `OdooTimeoutError`. So an `instanceof OdxError` branch that re-throws everything else (as above) is the correct shape when you use cancellation.
215
+
-**`MissingFnNameError` from `call_method` is a rejected promise, not a synchronous throw.** It's raised client-side before any network call, but via `Promise.reject`, so it's still caught by a `try/catch` around `await` (or a `.catch()`) — just don't expect it to throw before the `await`.
0 commit comments