From 5f7922d6e21e31c83c82db6be59393b347ca38e7 Mon Sep 17 00:00:00 2001 From: Corentin Leruth Date: Wed, 8 Feb 2023 18:02:42 +0100 Subject: [PATCH] refactor: use raise_error in more places --- src/ppx_import.ml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/ppx_import.ml b/src/ppx_import.ml index c508e25..aaa6eae 100644 --- a/src/ppx_import.ml +++ b/src/ppx_import.ml @@ -550,17 +550,8 @@ let module_type ~tool_name ~input_name (package_type : Ppxlib.package_type) = in Ast_helper.Mty.mk ~attrs:[] (Pmty_signature psig) | {mtd_type = None; _} -> - let ext = - Ppxlib.Location.error_extensionf ~loc - "Imported module is abstract" - in - Ast_builder.Default.pmty_extension ~loc ext - | _ -> - let ext = - Ppxlib.Location.error_extensionf ~loc - "Imported module is indirectly defined" - in - Ast_builder.Default.pmty_extension ~loc ext ) + raise_error ~loc "Imported module is abstract" + | _ -> raise_error ~loc "Imported module is indirectly defined" ) with Error {loc; error} -> let ext = Ppxlib.Location.error_extensionf ~loc "%s" error in Ast_builder.Default.pmty_extension ~loc ext