@@ -225,8 +225,9 @@ async def _invoke_hook(request: PromptPreprocessingRequest) -> None:
225225 err_msg = "Error calling prompt preprocessing hook"
226226 logger .error (err_msg , exc_info = True , exc = repr (exc ))
227227 # TODO: Determine if it's practical to emit a stack trace the server can display
228+ ui_cause = f"{ err_msg } \n ({ type (exc ).__name__ } : { exc } )"
228229 error_details = SerializedLMSExtendedErrorDict (
229- cause = repr ( exc ) , stack = "\n " .join (format_tb (exc .__traceback__ ))
230+ cause = ui_cause , stack = "\n " .join (format_tb (exc .__traceback__ ))
230231 )
231232 else :
232233 if response is None :
@@ -240,8 +241,8 @@ async def _invoke_hook(request: PromptPreprocessingRequest) -> None:
240241 try :
241242 parsed_response = load_struct (response , expected_cls )
242243 except ValidationError as exc :
243- err_msg = f"Failed to parse prompt preprocessing response as { expected_cls .__name__ } "
244- logger .error (err_msg , exc_info = True , exc = repr ( exc ) )
244+ err_msg = f"Failed to parse prompt preprocessing response as { expected_cls .__name__ } \n ( { exc } ) "
245+ logger .error (err_msg )
245246 error_details = SerializedLMSExtendedErrorDict (
246247 cause = err_msg
247248 )
@@ -255,6 +256,12 @@ async def _invoke_hook(request: PromptPreprocessingRequest) -> None:
255256 error_details = SerializedLMSExtendedErrorDict (cause = err_msg )
256257 channel_message : DictObject
257258 if error_details is not None :
259+ error_title = f"Prompt preprocessing error in plugin { plugin_name !r} "
260+ common_error_args : SerializedLMSExtendedErrorDict = {
261+ "title" : error_title ,
262+ "rootTitle" : error_title ,
263+ }
264+ error_details .update (common_error_args )
258265 channel_message = PromptPreprocessingErrorDict (
259266 type = "error" ,
260267 taskId = request .task_id ,
0 commit comments