Skip to content

Commit

Permalink
Panic in error situations
Browse files Browse the repository at this point in the history
  • Loading branch information
poorna2152 committed Sep 27, 2024
1 parent e11b84f commit 98f9997
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions langlib/lang.query/src/main/ballerina/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import ballerina/lang.'xml as lang_xml;
import ballerina/lang.'stream as lang_stream;
import ballerina/lang.'table as lang_table;
import ballerina/lang.'object as lang_object;
import ballerina/lang.'function as lang_function;
import ballerina/lang.'function;

# A type parameter that is a subtype of `any|error`.
# Has the special semantic that when used in a declaration
Expand Down Expand Up @@ -1054,14 +1054,14 @@ class _OrderTreeNode {
return orderedFrames;
}

# sorting is not supported for any[], therefore have to resolve runtime type and sort it.
# sorting is not supported for any[], thus use the `function:call` method call the sort operation.
# + return - ordered array.
function getSortedArray(any[] arr) returns any[] {
any|error res = lang_function:call(lang_array:sort, arr, self.nodesDirection);
any|error res = function:call(lang_array:sort, arr, self.nodesDirection);
if res is any[] {
return res;
}
return arr;
panic error(string `Error while sorting the arr: ${arr.toBalString()}`);
}

# copy every element of source array into empty target array.
Expand Down

0 comments on commit 98f9997

Please sign in to comment.