ENH:get printer error when binding error occurs

Change-Id: I492d48cacb341329e6981f9f2ddc180e30d2bd30
This commit is contained in:
tao wang 2023-06-28 18:06:28 +08:00 committed by Lane.Wei
parent 8060299515
commit 5631ea245e
2 changed files with 22 additions and 1 deletions

View file

@ -489,12 +489,32 @@ wxString get_fail_reason(int code)
this->Disconnect(EVT_BIND_UPDATE_MESSAGE, wxCommandEventHandler(BindMachineDialog::on_update_message), NULL, this);
}
wxString BindMachineDialog::get_print_error(wxString str)
{
wxString extra;
try {
json j = json::parse(str.ToStdString());
if (j.contains("err_code")) {
int error_code = j["err_code"].get<int>();
extra = wxGetApp().get_hms_query()->query_print_error_msg(error_code);
}
}
catch (...) {
;
}
if (extra.empty())
extra = str;
return extra;
}
void BindMachineDialog::show_bind_failed_info(bool show, int code, wxString description, wxString extra)
{
if (show) {
if (!m_sw_bind_failed_info->IsShown()) {
m_sw_bind_failed_info->Show(true);
extra = get_print_error(extra.ToStdString());
m_st_txt_error_code->SetLabelText(wxString::Format("%d", m_result_code));
m_st_txt_error_desc->SetLabelText( wxGetApp().filter_string(m_result_info));
m_st_txt_extra_info->SetLabelText( wxGetApp().filter_string(m_result_extra));

View file

@ -94,6 +94,7 @@ public:
void on_show(wxShowEvent &event);
void on_close(wxCloseEvent& event);
void on_destroy();
wxString get_print_error(wxString str);
};
class UnBindMachineDialog : public DPIDialog