-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: re-land papyrus error handling fix #2329
base: main
Are you sure you want to change the base?
Conversation
This reverts commit f88a768.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to cd71610 in 50 seconds
More details
- Looked at
953
lines of code in7
files - Skipped
0
files when reviewing. - Skipped posting
11
drafted comments based on config settings.
1. unit/VarValueTest.cpp:9
- Draft comment:
Good tests for boolean comparisons. The use of REQUIRE with casting to bool is clear. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
2. unit/VarValueTest.cpp:19
- Draft comment:
Test for the assignment operator on owning objects is clear. Consider covering deep copy edge cases further, though current test verifies that stringHolder is deep-copied. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
3. unit/VarValueTest.cpp:44
- Draft comment:
Equality operator tests for objects are straightforward. Test verifies that equal objects (by value) compare equal and different values compare unequal. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
4. unit/VarValueTest.cpp:82
- Draft comment:
Tests for wrong types and casting functions look adequate. Ensure that numeric conversions (e.g. from string to int or float) behave as expected. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
5. unit/VarValueTest.cpp:97
- Draft comment:
The strcat implicit cast test is concise and confirms the functionality provided by OpcodesImplementation::StrCat. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
6. unit/VarValueTest.cpp:105
- Draft comment:
Mixed arithmetics test checks various math operations and matches string output. The use of string streams validates the print representation. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
7. unit/VarValueTest.cpp:124
- Draft comment:
Cast to string tests cover both numeric and array cases. The expected output of '[None, None]' for an array of None is verified. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
8. unit/VarValueTest.cpp:136
- Draft comment:
Final operator== test is clear in verifying string equality and differences. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
9. papyrus-vm/src/papyrus-vm-lib/VarValue.cpp:221
- Draft comment:
In the ToDouble function, the kType_Float case casts the value to int32_t before conversion, losing the fractional part. Use the float value directly (e.g. v.data.f) instead. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
10. papyrus-vm/src/papyrus-vm-lib/VarValue.cpp:327
- Draft comment:
The operator/ for integers returns 1 when division by zero occurs, which can mask errors. Consider explicitly handling division by zero instead of defaulting to 1. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
11. papyrus-vm/src/papyrus-vm-lib/VarValue.cpp:629
- Draft comment:
Using a precision value of 9000 in snprintf for CastToString in the float case is excessively high and may cause formatting issues. Consider using a more typical precision value. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_BoWUx2EhFMmqMTiy
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
I would still first implement execution budget |
spdlog::error("ActivePexInstance::GetVariableValueByName - " | ||
"GetVariableByName errored with '{}'", | ||
e.what()); | ||
noneVar = VarValue::None(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is better to declare and initialize this before try
.
} catch (...) { | ||
spdlog::critical("ActivePexInstance::GetVariableValueByName - " | ||
"GetVariableByName errored with unknown error"); | ||
noneVar = VarValue::None(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better initialize it once somewhere before try
.
Reverts #2314
Important
Reintroduces error handling improvements in Papyrus VM by replacing exceptions with logging and default returns, updating related tests.
spdlog
logging inActivePexInstance.cpp
,VarValue.cpp
, andVirtualMachine.cpp
.ExecuteOpCode
,GetVariableValueByName
, andCallMethod
now log errors and return default values instead of throwing exceptions.noexcept
toExecuteAll
andExecuteOpCode
inActivePexInstance.h
.ExceptionHandler
fromVirtualMachine.h
.VarValueTest.cpp
for identifier and nonexistent types.This description was created by
for cd71610. It will automatically update as commits are pushed.