-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error responses will now reject the sendMessage promise instead of re…
…solving them. Additionally, promises are now more aggressive about rejecting on unexpected errors, to avoid situations where promises can await forever.
- Loading branch information
Showing
7 changed files
with
206 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { PhoenixOkReply, PhoenixReply } from './reply' | ||
import { | ||
PhoenixConnectionError, | ||
PhoenixInternalServerError, | ||
PhoenixRespondedWithError, | ||
} from './errors' | ||
|
||
/** | ||
* A container object representing a promise waiting on a reply from the Phoenix server. | ||
*/ | ||
export type ReplyQueueEntry = { | ||
onReply: (reply: PhoenixOkReply) => void | ||
onError: ( | ||
error: PhoenixConnectionError | PhoenixInternalServerError | PhoenixRespondedWithError | ||
) => void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
/** | ||
* A container object representing a reply from the Phoenix server. Includes the status and an optional response payload. | ||
*/ | ||
export type PhoenixReply = { | ||
export type PhoenixReply = PhoenixOkReply | PhoenixErrorReply | ||
|
||
export type PhoenixOkReply = { | ||
response: { [key: string]: any } | string | ||
status: 'ok' | 'error' | ||
status: 'ok' | ||
} | ||
|
||
export type PhoenixErrorReply = { | ||
response: { [key: string]: any } | string | ||
status: 'error' | ||
} |
Oops, something went wrong.