-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathErrorFound.fmfn
More file actions
38 lines (35 loc) · 1.27 KB
/
ErrorFound.fmfn
File metadata and controls
38 lines (35 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* =====================================
* ErrorFound
*
* RETURNS: (boolean)
* True if the private local variable contained an error, otherwise False
*
* DEPENDENCIES:
* ErrorGetAsJSON, ErrorIf, ErrorIfSetCustomElement
*
* REFERENCES:
* Full documentation can be found at https://github.com/dansmith65/FileMaker-Error-Handling.
* Either [the entire license](https://github.com/dansmith65/FileMaker-Error-Handling/blob/master/LICENSE)
* or this sentence shall be included in all copies or substantial portions of the Software.
*
* HISTORY:
* 2024-JUL-08 Daniel Smith dan@filemaker.consulting
* - created based on various old iterations of the same basic function
* =====================================
*/
Case (
ErrorGetAsJSON = "{}" ;
False
;
Left ( ErrorGetAsJSON ; 1 ) ≠ "{" or Right ( ErrorGetAsJSON ; 1 ) ≠ "}" ;
/* DO NOT want to use JSONFormatElements here since this is called by other functions
which get called often so should not alter FileMaker's internal JSON cache unless
an error found. */
ErrorIf ( True ; "CF: ErrorFound" ; 2 ; "the stored error was not a valid JSON object" )
and ErrorIfSetCustomElement ( "theErrorObject" ; ErrorGetAsJSON ; JSONString )
;
GetAsBoolean (
JSONGetElement ( ErrorGetAsJSON ; "code" )
)
)