Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit b2730f8

Browse files
committed
[[ Foundation ]] Implement basic versions of MCError unwind info fetching.
1 parent f6aa9a0 commit b2730f8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

libfoundation/src/foundation-error.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@ bool MCErrorCreate(MCTypeInfoRef p_typeinfo, MCArrayRef p_info, MCErrorRef& r_er
5454

5555
bool MCErrorUnwind(MCErrorRef p_error, MCValueRef p_target, uindex_t p_row, uindex_t p_column)
5656
{
57+
if (p_error -> target != nil)
58+
return true;
59+
5760
p_error -> target = MCValueRetain(p_target);
5861
p_error -> row = p_row;
5962
p_error -> column = p_column;
63+
6064
return true;
6165
}
6266

@@ -75,6 +79,26 @@ MCStringRef MCErrorGetMessage(MCErrorRef self)
7579
return self -> message;
7680
}
7781

82+
uindex_t MCErrorGetDepth(MCErrorRef self)
83+
{
84+
return self -> target != nil ? 1 : 0;
85+
}
86+
87+
MCValueRef MCErrorGetTargetAtLevel(MCErrorRef self, uindex_t level)
88+
{
89+
return self -> target;
90+
}
91+
92+
uindex_t MCErrorGetRowAtLevel(MCErrorRef self, uindex_t row)
93+
{
94+
return self -> row;
95+
}
96+
97+
uindex_t MCErrorGetColumnAtLevel(MCErrorRef self, uindex_t column)
98+
{
99+
return self -> column;
100+
}
101+
78102
////////////////////////////////////////////////////////////////////////////////
79103

80104
bool MCErrorThrow(MCErrorRef p_error)

0 commit comments

Comments
 (0)