@@ -44,6 +44,7 @@ For installation information, see the [Node-oracledb Installation Instructions][
44
44
- 2.1.1 [`errorNum`](#properrerrornum)
45
45
- 2.1.2 [`message`](#properrmessage)
46
46
- 2.1.3 [`offset`](#properroffset)
47
+ - 2.1.4 [`stack`](#properrstack)
47
48
3. [Oracledb Class](#oracledbclass)
48
49
- 3.1 [Oracledb Constants](#oracledbconstants)
49
50
- 3.1.1 [Query `outFormat` Constants](#oracledbconstantsoutformat)
@@ -817,9 +818,23 @@ same is true for invalid operations on read-only or write-only
817
818
properties. If an unrecognized property name is used, it will be
818
819
ignored.
819
820
821
+ An example of catching an error is:
822
+
823
+ ```javascript
824
+ async function run(connection) {
825
+ try {
826
+ const sql = `SELECT * FROM DOESNOTEXIST`;
827
+ result = await connection.execute(sql);
828
+ return result;
829
+ } catch (err) {
830
+ console.error(err);
831
+ }
832
+ }
833
+ ```
834
+
820
835
### <a name="properror"></a> 2.1 Error Properties
821
836
822
- The *Error* object contains `errorNum`, `message` and `offset ` properties.
837
+ The *Error* object contains `errorNum`, `message`, `offset` and `stack ` properties.
823
838
824
839
#### <a name="properrerrornum"></a> 2.1.1 `errorNum`
825
840
@@ -876,6 +891,21 @@ indicating which record could not be processed. See [Handling Data
876
891
Errors](#handlingbatcherrors). In node-oracledb 4.2, the maximum `offset` value
877
892
was changed from (2^16)-1 to (2^32)-1.
878
893
894
+ #### <a name="properrstack"></a> 2.1.4 `stack`
895
+
896
+ ```
897
+ String stack
898
+ ```
899
+
900
+ When using Promises or Async/Await, the *Error* object includes a stack trace,
901
+ for example:
902
+
903
+ ```
904
+ Error: ORA-00942: table or view does not exist
905
+ at async Object.myDoQuery (/Users/cjones/db.js:5:20)
906
+ at async run (/Users/cjones/test.js:51:14)}
907
+ ```
908
+
879
909
## <a name="oracledbclass"></a> 3. Oracledb Class
880
910
881
911
The *Oracledb* object is the factory class for *Pool* and *Connection* objects.
0 commit comments