Add more robust error handling to server
Changes:
- Use the proper RESTful HTTP status codes for all endpoints (e.g. 204 rather than 200 when the response body is empty)
- Add consistent and more helpful error messages
- Handle invalid route parameters by checking if jamid returns empty objects (e.g. invalid contact IDs)
- Use res.send() rather than res.json() for consistency
- Handle three new signals
GitLab: #111
Change-Id: I1d48dc4629995ab9a96bb2086a9aa91f81889598
diff --git a/server/src/jamid/jami-signal-interfaces.ts b/server/src/jamid/jami-signal-interfaces.ts
index 06dd6ed..a839309 100644
--- a/server/src/jamid/jami-signal-interfaces.ts
+++ b/server/src/jamid/jami-signal-interfaces.ts
@@ -59,7 +59,26 @@
export interface IncomingAccountMessage {
accountId: string;
from: string;
- message: Record<string, string>;
+ payload: Record<string, string>;
+}
+
+export interface AccountMessageStatusChanged {
+ accountId: string;
+ messageId: string;
+ peer: string;
+ state: number; // TODO: Replace state number with enum (see account_const.h)
+}
+
+export interface ContactAdded {
+ accountId: string;
+ contactId: string;
+ confirmed: boolean;
+}
+
+export interface ContactRemoved {
+ accountId: string;
+ contactId: string;
+ banned: boolean;
}
export interface ConversationReady {