Skip to content

Commit

Permalink
Merge pull request OCamlPro#334 from nberth/silence-cache-related-errors
Browse files Browse the repository at this point in the history
Silence cache-related errors
  • Loading branch information
nberth authored Jul 30, 2024
2 parents b20fcb1 + 75f32ba commit 2a30f4b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/lsp/cobol_lsp/lsp_project_cache.ml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ let load ~rootdir ~layout ~config =
fallback
| Some cache_file ->
try load_cache cache_file with
| Unix.Unix_error (e, op, args) ->
if config.cache_verbose then
Lsp_io.log_debug "Failed@ to@ read@ cache:@ %s %s:@ %s"
op args (Unix.error_message e);
fallback
| Sys_error msg ->
if config.cache_verbose then
Lsp_io.log_info "Failed@ to@ read@ cache:@ %s" msg;
Expand Down
13 changes: 8 additions & 5 deletions src/lsp/cobol_lsp/lsp_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,14 @@ let remove_project project r =
let save_project_caches
{ params = { config = { cache_config = config; _ }; _ };
docs; _ } =
try Lsp_project_cache.save ~config docs
with e ->
Lsp_error.internal
"Exception@ caught@ while@ saving@ project@ caches:@ %a@." Fmt.exn e

try Lsp_project_cache.save ~config docs with
| Unix.Unix_error (e, op, args) ->
if config.cache_verbose then
Lsp_io.log_debug "While@ saving@ project@ caches:@ %s %s:@ %s"
op args (Unix.error_message e)
| e ->
Lsp_error.internal
"Exception@ caught@ while@ saving@ project@ caches:@ %a@." Fmt.exn e

let load_project_cache ~rootdir
({ params = { config = { project_layout = layout;
Expand Down

0 comments on commit 2a30f4b

Please sign in to comment.