fix: improve error handling in 'Almoxarifado' product search to notify users when server function is not found, and update API imports for better functionality
This commit is contained in:
@@ -89,10 +89,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const message = err instanceof Error ? err.message : 'Erro ao buscar produto';
|
const errorMessage = err instanceof Error ? err.message : 'Erro ao buscar produto';
|
||||||
|
|
||||||
|
// Verificar se é erro de função não encontrada
|
||||||
|
if (errorMessage.includes('Could not find public function')) {
|
||||||
|
const message = 'Servidor Convex precisa ser reiniciado. A função de busca por código de barras não foi encontrada.';
|
||||||
if (mostrarMensagemSucesso) {
|
if (mostrarMensagemSucesso) {
|
||||||
mostrarMensagem('error', message);
|
mostrarMensagem('error', message);
|
||||||
}
|
}
|
||||||
|
console.error('Erro: Servidor Convex precisa ser reiniciado para reconhecer a nova função buscarMaterialPorCodigoBarras');
|
||||||
|
} else {
|
||||||
|
const message = errorMessage;
|
||||||
|
if (mostrarMensagemSucesso) {
|
||||||
|
mostrarMensagem('error', message);
|
||||||
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
buscandoProduto = false;
|
buscandoProduto = false;
|
||||||
}
|
}
|
||||||
|
|||||||
2
packages/backend/convex/_generated/api.d.ts
vendored
2
packages/backend/convex/_generated/api.d.ts
vendored
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type * as acoes from "../acoes.js";
|
import type * as acoes from "../acoes.js";
|
||||||
|
import type * as actions_buscarInfoProduto from "../actions/buscarInfoProduto.js";
|
||||||
import type * as actions_email from "../actions/email.js";
|
import type * as actions_email from "../actions/email.js";
|
||||||
import type * as actions_linkPreview from "../actions/linkPreview.js";
|
import type * as actions_linkPreview from "../actions/linkPreview.js";
|
||||||
import type * as actions_pushNotifications from "../actions/pushNotifications.js";
|
import type * as actions_pushNotifications from "../actions/pushNotifications.js";
|
||||||
@@ -106,6 +107,7 @@ import type {
|
|||||||
|
|
||||||
declare const fullApi: ApiFromModules<{
|
declare const fullApi: ApiFromModules<{
|
||||||
acoes: typeof acoes;
|
acoes: typeof acoes;
|
||||||
|
"actions/buscarInfoProduto": typeof actions_buscarInfoProduto;
|
||||||
"actions/email": typeof actions_email;
|
"actions/email": typeof actions_email;
|
||||||
"actions/linkPreview": typeof actions_linkPreview;
|
"actions/linkPreview": typeof actions_linkPreview;
|
||||||
"actions/pushNotifications": typeof actions_pushNotifications;
|
"actions/pushNotifications": typeof actions_pushNotifications;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
'use node';
|
||||||
|
|
||||||
import { action } from '../_generated/server';
|
import { action } from '../_generated/server';
|
||||||
import { v } from 'convex/values';
|
import { v } from 'convex/values';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user