Skip to content

Commit 3a857d9

Browse files
committed
Commands: consistent treatment of error messages when reading cmt files.
1 parent a4100e6 commit 3a857d9

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

analysis/src/Commands.ml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ let hover ~path ~line ~col =
5353
let uri = Uri2.fromLocalPath path in
5454
let result =
5555
match ProcessCmt.getFullFromCmt ~uri with
56-
| Error message -> Protocol.stringifyHover {contents = message}
56+
| Error message ->
57+
prerr_endline message;
58+
Protocol.null
5759
| Ok (package, {file; extra}) -> (
5860
let pos = Utils.protocolLineColToCmtLoc ~line ~col in
5961
match References.locItemForPos ~extra pos with
@@ -91,7 +93,9 @@ let definition ~path ~line ~col =
9193
let uri = Uri2.fromLocalPath path in
9294
let result =
9395
match ProcessCmt.getFullFromCmt ~uri with
94-
| Error _message -> Protocol.null
96+
| Error message ->
97+
prerr_endline message;
98+
Protocol.null
9599
| Ok (package, {file; extra}) -> (
96100
let pos = Utils.protocolLineColToCmtLoc ~line ~col in
97101

@@ -128,7 +132,9 @@ let references ~path ~line ~col =
128132
let uri = Uri2.fromLocalPath path in
129133
let result =
130134
match ProcessCmt.getFullFromCmt ~uri with
131-
| Error _message -> Protocol.null
135+
| Error message ->
136+
prerr_endline message;
137+
Protocol.null
132138
| Ok (package, {file; extra}) -> (
133139
let pos = Utils.protocolLineColToCmtLoc ~line ~col in
134140
match References.locItemForPos ~extra pos with
@@ -158,7 +164,9 @@ let references ~path ~line ~col =
158164
let documentSymbol ~path =
159165
let uri = Uri2.fromLocalPath path in
160166
match ProcessCmt.fileForUri uri with
161-
| Error _ -> print_endline Protocol.null
167+
| Error message ->
168+
prerr_endline message;
169+
print_endline Protocol.null
162170
| Ok (file, _extra) ->
163171
let open SharedTypes in
164172
let rec getItems {topLevel} =

0 commit comments

Comments
 (0)