1
+ /* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. */
2
+
3
+ /******************************************************************************
4
+ *
5
+ * You may not use the identified files except in compliance with the Apache
6
+ * License, Version 2.0 (the "License.")
7
+ *
8
+ * You may obtain a copy of the License at
9
+ * http://www.apache.org/licenses/LICENSE-2.0.
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ *
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ * The node-oracledb test suite uses 'mocha', 'should' and 'async'.
19
+ * See LICENSE.md for relevant licenses.
20
+ *
21
+ * NAME
22
+ * 240. errorOffset.js
23
+ *
24
+ * DESCRIPTION
25
+ * This test verifies a ODPI-C bug fix.
26
+ *
27
+ *****************************************************************************/
28
+ 'use strict' ;
29
+
30
+ const oracledb = require ( 'oracledb' ) ;
31
+ const should = require ( 'should' ) ;
32
+ const dbconfig = require ( './dbconfig.js' ) ;
33
+
34
+ describe ( '240. errorOffset.js' , async ( ) => {
35
+
36
+ it ( '240.1 checks the offset value of the error' , async ( ) => {
37
+ let conn ;
38
+ try {
39
+ conn = await oracledb . getConnection ( dbconfig ) ;
40
+ } catch ( error ) {
41
+ should . not . exist ( error ) ;
42
+ }
43
+
44
+ try {
45
+ await conn . execute ( "begin t_Missing := 5; end;" ) ;
46
+ } catch ( error ) {
47
+ should . exist ( error ) ;
48
+ should . strictEqual ( error . offset , 6 ) ;
49
+ should . strictEqual ( error . errorNum , 6550 ) ;
50
+ }
51
+
52
+ try {
53
+ await conn . close ( ) ;
54
+ } catch ( error ) {
55
+ should . not . exist ( error ) ;
56
+ }
57
+ } ) ;
58
+ } ) ;
0 commit comments