Unifica finestre errori con testo completo, copia ed esportazione
This commit is contained in:
@@ -6,7 +6,8 @@ import asyncio
|
||||
import sys
|
||||
import tkinter as tk
|
||||
from concurrent.futures import Future
|
||||
from tkinter import messagebox, ttk
|
||||
import error_dialog as messagebox
|
||||
from tkinter import ttk
|
||||
from typing import Callable
|
||||
|
||||
from runtime_support import configure_exception_logging, ensure_stdio, log_exception, run_with_fatal_log
|
||||
@@ -675,19 +676,20 @@ class BarcodeClientApp:
|
||||
elif isinstance(result, BarcodeViewState):
|
||||
self._apply_state(result)
|
||||
|
||||
def _show_transaction_error(self) -> None:
|
||||
def _show_transaction_error(self, exception: Exception) -> None:
|
||||
messagebox.showerror(
|
||||
"Barcode WMS",
|
||||
"Operazione non completata.\n\n"
|
||||
"Ripeti la lettura o avvisa il responsabile.\n"
|
||||
"Il dettaglio tecnico e' stato scritto nel log.",
|
||||
parent=self.root,
|
||||
exception=exception,
|
||||
)
|
||||
|
||||
def _poll_recovery_future(self, original_exception: Exception) -> None:
|
||||
if self._pending is None:
|
||||
self._set_busy(False)
|
||||
self._show_transaction_error()
|
||||
self._show_transaction_error(original_exception)
|
||||
return
|
||||
if not self._pending.done():
|
||||
self.root.after(40, lambda err=original_exception: self._poll_recovery_future(err))
|
||||
@@ -704,14 +706,16 @@ class BarcodeClientApp:
|
||||
current.status_text = "Transazione non completata, ripeti l'operazione."
|
||||
current.status_color = "#f4cccc"
|
||||
self._apply_state(current)
|
||||
self._show_transaction_error()
|
||||
# Keep both failures when reconciliation also fails asynchronously.
|
||||
self._show_transaction_error(ExceptionGroup(
|
||||
"Barcode operation and recovery failed", [original_exception, exc]))
|
||||
return
|
||||
|
||||
if isinstance(result, BarcodeActionResult):
|
||||
self._apply_state(result.state)
|
||||
if not result.ok:
|
||||
self.root.bell()
|
||||
self._show_transaction_error()
|
||||
self._show_transaction_error(original_exception)
|
||||
elif isinstance(result, BarcodeViewState):
|
||||
self._apply_state(result)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user