-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43025 from ballerina-platform/master
Merge master to Java21 branch
- Loading branch information
Showing
14 changed files
with
228 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,3 +124,6 @@ salary = 25000.0 | |
[[main.empInfoTab]] | ||
id = 303 | ||
name = "belle" | ||
|
||
[main.customConfig] | ||
username = "chiranS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...t/src/test/resources/test-src/types/intersection/error-intersection-access/Ballerina.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
org = "testorg" | ||
name = "error_intersection_access" | ||
version = "0.1.0" | ||
|
||
[build-options] | ||
observabilityIncluded = true |
56 changes: 56 additions & 0 deletions
56
.../test-src/types/intersection/error-intersection-access/error_intersection_access_test.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). | ||
// | ||
// WSO2 LLC. licenses this file to you under the Apache License, | ||
// Version 2.0 (the "License"); you may not use this file except | ||
// in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
import error_intersection_access.error_intersection_mod as err_lib; | ||
|
||
const MESSAGE = "Message"; | ||
|
||
public function testErrorIntersectionFromImportedModule() { | ||
err_lib:RemoteServerError remoteServerErr = error err_lib:RemoteServerError(MESSAGE); | ||
assertError(remoteServerErr); | ||
|
||
err_lib:ApplicationResponseError applResponeErr = error err_lib:ApplicationResponseError(MESSAGE); | ||
assertError(applResponeErr); | ||
|
||
err_lib:ClientRequestErrorWithStatusCode clientReqErrWithStatusCode = error (MESSAGE, code = 404); | ||
assertError(clientReqErrWithStatusCode, 404); | ||
|
||
err_lib:ApplicationResponseErrorWithStatusCode appRespErrWithStatusCode = error (MESSAGE, code = 401); | ||
assertError(appRespErrWithStatusCode, 401); | ||
|
||
err_lib:BadRequestError badReqErr = error err_lib:BadRequestError(MESSAGE, code = 400); | ||
assertError(badReqErr, 400); | ||
|
||
err_lib:Error err = error err_lib:Error(MESSAGE); | ||
assertError(err); | ||
} | ||
|
||
function assertError(any|error actual, int? code = ()) { | ||
if actual !is error { | ||
panic error(string `expected an error, found '${actual.toString()}'`); | ||
} | ||
|
||
if MESSAGE != actual.message() { | ||
panic error(string `expected message: '${MESSAGE}', found: '${actual.message()}'`); | ||
} | ||
|
||
if code != () { | ||
var detail = <record {|int code;|} & readonly> actual.detail(); | ||
if code != detail.code { | ||
panic error(string `expected code: '${code}', found: '${detail.code}'`); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...ction/error-intersection-access/modules/error_intersection_mod/error_intersection_mod.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). | ||
// | ||
// WSO2 LLC. licenses this file to you under the Apache License, | ||
// Version 2.0 (the "License"); you may not use this file except | ||
// in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
public type Status record { | ||
int code; | ||
}; | ||
|
||
public type Error distinct error; | ||
|
||
public type ClientRequestError distinct Error & error; | ||
|
||
public type RemoteServerError distinct error & error; | ||
|
||
public type ApplicationResponseError distinct ClientRequestError & RemoteServerError; | ||
|
||
public type ApplicationResponseErrorWithStatusCode distinct ApplicationResponseError & error<Status>; | ||
|
||
public type ClientRequestErrorWithStatusCode distinct ClientRequestError & error<Status>; | ||
|
||
public type BadRequestError distinct ApplicationResponseErrorWithStatusCode & ClientRequestErrorWithStatusCode; |