fix: surface detailed simulation errors including InsufficientFundsFo…#951
fix: surface detailed simulation errors including InsufficientFundsFo…#951Sushil-19 wants to merge 4 commits intosolana-foundation:masterfrom
Conversation
|
@Sushil-19 is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR replaces the hardcoded Confidence Score: 5/5Safe to merge — the change is a clear improvement over the previous hardcoded generic error string, with only minor style-level findings. All findings are P2 (stale comment, loose No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[simulateTransaction response] --> B{resp.value.err?}
B -- no --> C[No error set]
B -- yes --> D[parseSimulationError]
D --> E{logs include InsufficientFundsForFee?}
E -- yes --> F[Return human-readable fee message]
E -- no --> G{typeof err === string?}
G -- yes --> H{err includes InsufficientFundsForFee?}
H -- yes --> F
H -- no --> I[Return err string as-is]
G -- no --> J{typeof err === object?}
J -- yes --> K{InsufficientFundsForFee in err?}
K -- yes --> F
K -- no --> L[Return JSON.stringify err]
J -- no --> M[Return Transaction failed]
F --> N[setError with message]
I --> N
L --> N
M --> N
Reviews (1): Last reviewed commit: "fix: surface detailed simulation errors ..." | Re-trigger Greptile |
| if (logs?.some(l => l.includes('InsufficientFundsForFee'))) { | ||
| return 'Insufficient funds for transaction fee'; | ||
| } |
There was a problem hiding this comment.
Logs scanned before the error object is inspected
The function checks whether any log line contains 'InsufficientFundsForFee' before examining the structured err value. A log line from an inner CPI call or a diagnostic message that merely mentions that string would trigger the wrong human-readable label even if the real top-level error is something different (e.g. InstructionError). Inspecting the structured err first is more reliable; fall back to log-scanning only when the error object doesn't match.
added recommended comment Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
added the recommended preferred types instead of using any Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
Updated, prioritizing structured error over logs. |
…rFee
Description
Type of change
Screenshots
Testing
Related Issues
Checklist
build:infoscript to update build informationAdditional Notes