Line | Count | Source |
1 | | |
2 | | /* |
3 | | * Copyright (C) Dmitry Volyntsev |
4 | | * Copyright (C) NGINX, Inc. |
5 | | */ |
6 | | |
7 | | #ifndef _NJS_ERROR_H_INCLUDED_ |
8 | | #define _NJS_ERROR_H_INCLUDED_ |
9 | | |
10 | | |
11 | | #define njs_error(vm, fmt, ...) \ |
12 | 0 | njs_throw_error(vm, NJS_OBJ_TYPE_ERROR, fmt, ##__VA_ARGS__) |
13 | | #define njs_eval_error(vm, fmt, ...) \ |
14 | | njs_throw_error(vm, NJS_OBJ_TYPE_EVAL_ERROR, fmt, ##__VA_ARGS__) |
15 | | #define njs_internal_error(vm, fmt, ...) \ |
16 | 2.92k | njs_throw_error(vm, NJS_OBJ_TYPE_INTERNAL_ERROR, fmt, ##__VA_ARGS__) |
17 | | #define njs_range_error(vm, fmt, ...) \ |
18 | 1.98k | njs_throw_error(vm, NJS_OBJ_TYPE_RANGE_ERROR, fmt, ##__VA_ARGS__) |
19 | | #define njs_reference_error(vm, fmt, ...) \ |
20 | 37.0k | njs_throw_error(vm, NJS_OBJ_TYPE_REF_ERROR, fmt, ##__VA_ARGS__) |
21 | | #define njs_syntax_error(vm, fmt, ...) \ |
22 | 40.4k | njs_throw_error(vm, NJS_OBJ_TYPE_SYNTAX_ERROR, fmt, ##__VA_ARGS__) |
23 | | #define njs_type_error(vm, fmt, ...) \ |
24 | 253k | njs_throw_error(vm, NJS_OBJ_TYPE_TYPE_ERROR, fmt, ##__VA_ARGS__) |
25 | | #define njs_uri_error(vm, fmt, ...) \ |
26 | 0 | njs_throw_error(vm, NJS_OBJ_TYPE_URI_ERROR, fmt, ##__VA_ARGS__) |
27 | | |
28 | | void njs_error_new(njs_vm_t *vm, njs_value_t *dst, njs_object_t *proto, |
29 | | u_char *start, size_t size); |
30 | | void njs_noinline njs_error_fmt_new(njs_vm_t *vm, njs_value_t *dst, |
31 | | njs_object_type_t type, const char *fmt, ...); |
32 | | void njs_throw_error(njs_vm_t *vm, njs_object_type_t type, const char *fmt, |
33 | | ...); |
34 | | void njs_throw_error_va(njs_vm_t *vm, njs_object_t *proto, const char *fmt, |
35 | | va_list args); |
36 | | |
37 | | void njs_memory_error(njs_vm_t *vm); |
38 | | void njs_memory_error_set(njs_vm_t *vm, njs_value_t *value); |
39 | | |
40 | | njs_object_t *njs_error_alloc(njs_vm_t *vm, njs_object_t *proto, |
41 | | const njs_value_t *name, const njs_value_t *message, |
42 | | const njs_value_t *errors); |
43 | | njs_int_t njs_error_to_string(njs_vm_t *vm, njs_value_t *retval, |
44 | | const njs_value_t *error); |
45 | | njs_int_t njs_error_stack(njs_vm_t *vm, njs_value_t *value, njs_value_t *stack); |
46 | | njs_int_t njs_error_stack_attach(njs_vm_t *vm, njs_value_t value); |
47 | | |
48 | | |
49 | | extern const njs_object_type_init_t njs_error_type_init; |
50 | | extern const njs_object_type_init_t njs_eval_error_type_init; |
51 | | extern const njs_object_type_init_t njs_internal_error_type_init; |
52 | | extern const njs_object_type_init_t njs_range_error_type_init; |
53 | | extern const njs_object_type_init_t njs_reference_error_type_init; |
54 | | extern const njs_object_type_init_t njs_syntax_error_type_init; |
55 | | extern const njs_object_type_init_t njs_type_error_type_init; |
56 | | extern const njs_object_type_init_t njs_uri_error_type_init; |
57 | | extern const njs_object_type_init_t njs_memory_error_type_init; |
58 | | extern const njs_object_type_init_t njs_aggregate_error_type_init; |
59 | | |
60 | | |
61 | | njs_inline njs_int_t |
62 | | njs_is_memory_error(njs_vm_t *vm, njs_value_t *value) |
63 | 27.6k | { |
64 | 27.6k | if (njs_is_error(value) |
65 | 20.5k | && njs_has_prototype(vm, value, NJS_OBJ_TYPE_INTERNAL_ERROR) |
66 | 1 | && !njs_object(value)->extensible) |
67 | 0 | { |
68 | 0 | return 1; |
69 | 0 | } |
70 | | |
71 | 27.6k | return 0; |
72 | 27.6k | } Unexecuted instantiation: njs_arr.c:njs_is_memory_error Unexecuted instantiation: njs_rbtree.c:njs_is_memory_error Unexecuted instantiation: njs_mp.c:njs_is_memory_error Unexecuted instantiation: njs_sprintf.c:njs_is_memory_error Unexecuted instantiation: njs_value.c:njs_is_memory_error Unexecuted instantiation: njs_atom.c:njs_is_memory_error Unexecuted instantiation: njs_vm.c:njs_is_memory_error Unexecuted instantiation: njs_vmcode.c:njs_is_memory_error Unexecuted instantiation: njs_parser.c:njs_is_memory_error Unexecuted instantiation: njs_variable.c:njs_is_memory_error Unexecuted instantiation: njs_scope.c:njs_is_memory_error Unexecuted instantiation: njs_generator.c:njs_is_memory_error Unexecuted instantiation: njs_disassembler.c:njs_is_memory_error Unexecuted instantiation: njs_module.c:njs_is_memory_error Unexecuted instantiation: njs_extern.c:njs_is_memory_error Unexecuted instantiation: njs_number.c:njs_is_memory_error Unexecuted instantiation: njs_symbol.c:njs_is_memory_error Unexecuted instantiation: njs_string.c:njs_is_memory_error Unexecuted instantiation: njs_object.c:njs_is_memory_error Unexecuted instantiation: njs_object_prop.c:njs_is_memory_error Unexecuted instantiation: njs_array.c:njs_is_memory_error Unexecuted instantiation: njs_json.c:njs_is_memory_error Unexecuted instantiation: njs_function.c:njs_is_memory_error Unexecuted instantiation: njs_regexp.c:njs_is_memory_error Unexecuted instantiation: njs_date.c:njs_is_memory_error Unexecuted instantiation: njs_error.c:njs_is_memory_error Unexecuted instantiation: njs_array_buffer.c:njs_is_memory_error Unexecuted instantiation: njs_typed_array.c:njs_is_memory_error njs_promise.c:njs_is_memory_error Line | Count | Source | 63 | 599 | { | 64 | 599 | if (njs_is_error(value) | 65 | 0 | && njs_has_prototype(vm, value, NJS_OBJ_TYPE_INTERNAL_ERROR) | 66 | 0 | && !njs_object(value)->extensible) | 67 | 0 | { | 68 | 0 | return 1; | 69 | 0 | } | 70 | | | 71 | 599 | return 0; | 72 | 599 | } |
Unexecuted instantiation: njs_iterator.c:njs_is_memory_error njs_async.c:njs_is_memory_error Line | Count | Source | 63 | 27.0k | { | 64 | 27.0k | if (njs_is_error(value) | 65 | 20.5k | && njs_has_prototype(vm, value, NJS_OBJ_TYPE_INTERNAL_ERROR) | 66 | 1 | && !njs_object(value)->extensible) | 67 | 0 | { | 68 | 0 | return 1; | 69 | 0 | } | 70 | | | 71 | 27.0k | return 0; | 72 | 27.0k | } |
Unexecuted instantiation: njs_builtin.c:njs_is_memory_error Unexecuted instantiation: njs_regex.c:njs_is_memory_error Unexecuted instantiation: njs_buffer.c:njs_is_memory_error Unexecuted instantiation: njs_modules.c:njs_is_memory_error Unexecuted instantiation: njs_dtoa.c:njs_is_memory_error Unexecuted instantiation: njs_dtoa_fixed.c:njs_is_memory_error Unexecuted instantiation: njs_strtod.c:njs_is_memory_error Unexecuted instantiation: njs_djb_hash.c:njs_is_memory_error Unexecuted instantiation: njs_utf8.c:njs_is_memory_error Unexecuted instantiation: njs_utf16.c:njs_is_memory_error Unexecuted instantiation: njs_flathsh.c:njs_is_memory_error Unexecuted instantiation: njs_trace.c:njs_is_memory_error Unexecuted instantiation: njs_malloc.c:njs_is_memory_error Unexecuted instantiation: njs_utils.c:njs_is_memory_error Unexecuted instantiation: njs_chb.c:njs_is_memory_error Unexecuted instantiation: njs_lexer.c:njs_is_memory_error Unexecuted instantiation: njs_boolean.c:njs_is_memory_error Unexecuted instantiation: njs_math.c:njs_is_memory_error Unexecuted instantiation: njs_encoding.c:njs_is_memory_error Unexecuted instantiation: njs_diyfp.c:njs_is_memory_error Unexecuted instantiation: njs_str.c:njs_is_memory_error Unexecuted instantiation: njs_random.c:njs_is_memory_error |
73 | | |
74 | | |
75 | | #endif /* _NJS_BOOLEAN_H_INCLUDED_ */ |