File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ local M = {}
4
4
--- @param err ErrorResponse
5
5
--- @return string ?
6
6
function M .fmt_error (err )
7
- local body = err .body
7
+ local body = err .body or {}
8
8
if body .error and body .error .showUser then
9
9
local msg = body .error .format
10
10
for key , val in pairs (body .error .variables or {}) do
Original file line number Diff line number Diff line change
1
+ local utils = require (' dap.utils' )
2
+
1
3
describe (' utils.index_of' , function ()
2
4
it (' returns index of first item where predicate matches' , function ()
3
5
local result = require (' dap.utils' ).index_of (
@@ -79,4 +81,11 @@ describe('utils.fmt_error', function ()
79
81
}
80
82
}))
81
83
end )
84
+
85
+ it (' can handle response without body part' , function ()
86
+ local result = utils .fmt_error ({
87
+ message = ' Bad things happen' ,
88
+ })
89
+ assert .are .same (' Bad things happen' , result )
90
+ end )
82
91
end )
You can’t perform that action at this time.
0 commit comments