1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/* 17 * @tc.name:moduleHandleException 18 * @tc.desc:moduleHandleException 19 * @tc.type: FUNC 20 * @tc.require: issueI5NO8G 21 */ 22 23import('./B.js').then((m) => { 24 print("import success 1"); 25 m.b; 26}).catch((e) => { 27 print("first, " + e.toString()); 28}) 29 30// test same file 31import('./B.js').then((m) => { 32 print("import success 2"); 33 m.b; 34}).catch((e) => { 35 print("same file, " + e.toString()); 36}) 37 38// test child file 39import('./A.js').then((m) => { 40 print("import success 3"); 41 m.a; 42}).catch((e) => { 43 print("child file, " + e.toString()); 44}) 45 46// test parent file 47import('./C.js').then((m) => { 48 print("import success 4"); 49 m.a; 50}).catch((e) => { 51 print("parent file, " + e.toString()); 52}) 53 54// test other file 55import('./E.js').then((m) => { 56 print("import success 5"); 57 m.d; 58}).catch((e) => { 59 print("other file, " + e.toString()); 60}) 61 62// shared module first 63import('./importShared1.js').then((m) => { 64 print("import success 6"); 65 m.importShared1; 66}).catch((e) => { 67 print("shared module first import, " + e.toString()); 68}) 69 70// shared module get stored error 71import('./importShared2.js').then((m) => { 72 print("import success 7"); 73 m.fooA(); 74}).catch((e) => { 75 print("shared module, " + e.toString()); 76}) 77 78// shared module get child error 79import('./importSharedChild.js').then((m) => { 80 print("import success 8"); 81 m.fooA(); 82}).catch((e) => { 83 print("shared module child, " + e.toString()); 84}) 85 86// multi level 87import('./multiLevel1.js').then((m) => { 88 print("import success 9"); 89 m.mulA(); 90}).catch((e) => { 91 print("multi level, " + e.toString()); 92})