exupery-core-async 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,11 +7,18 @@ export interface Unsafe_Query_Result<T, E> {
|
|
|
7
7
|
then<NT>(handle_value: ($: T) => Unsafe_Query_Result<NT, E>): Unsafe_Query_Result<NT, E>;
|
|
8
8
|
catch(handle_exception: ($: E) => T): Safe_Query_Result<T>;
|
|
9
9
|
/**
|
|
10
|
-
* processes the queried data by executing a command
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* processes the queried data by executing a command.
|
|
11
|
+
*
|
|
12
|
+
* if the result on which this method is called is in an exception state, the command will not be executed.
|
|
13
|
+
* instead, the 2 other handlers will be called.
|
|
14
|
+
* first, the exception handler will be called, to report the exception.
|
|
15
|
+
* secondly, the exception will be mapped into a new exception value that has the same type as the command's exception type.
|
|
16
|
+
*
|
|
17
|
+
* @param handle_value the handler that will be called to process the queried data, if no exception has occurred
|
|
18
|
+
* @param handle_exception the handler that will process an exception if the query is in an exception state to allow reporting the exception
|
|
19
|
+
* @param map_exception the handler that will map the exception of the query into a new exception value of the command's exception type
|
|
20
|
+
*
|
|
14
21
|
*/
|
|
15
|
-
process(handle_value: ($: T) => Unsafe_Command_Result<
|
|
22
|
+
process<NE>(handle_value: ($: T) => Unsafe_Command_Result<NE>, handle_exception: ($: E) => Safe_Command_Result, map_exception: ($: E) => NE): Unsafe_Command_Result<NE>;
|
|
16
23
|
__start(on_value: ($: T) => void, on_exception: ($: E) => void): void;
|
|
17
24
|
}
|
package/dist/run_unsafe_query.js
CHANGED
|
@@ -43,13 +43,13 @@ class Unsafe_Query_Result_Class {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
process(handle_value, handle_exception) {
|
|
46
|
+
process(handle_value, handle_exception, map_exception) {
|
|
47
47
|
return (0, execute_unsafe_command_1.__execute_unsafe_command)({
|
|
48
48
|
'execute': (on_success, on_exception) => {
|
|
49
49
|
this.executer.execute((value) => {
|
|
50
50
|
handle_value(value).__start(on_success, on_exception);
|
|
51
51
|
}, (exception) => {
|
|
52
|
-
handle_exception(exception).__start(() => on_exception(exception));
|
|
52
|
+
handle_exception(exception).__start(() => on_exception(map_exception(exception)));
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
});
|