2
0
mirror of https://github.com/esiur/esiur-js.git synced 2025-05-06 04:22:58 +00:00

RecordParser

This commit is contained in:
Ahmed Zamil 2024-12-17 14:12:53 +03:00
parent dcc33d7394
commit 10aa5d2a22

View File

@ -172,9 +172,14 @@ export default class DataDeserializer {
DataDeserializer.listParser(data, offset, length, connection, requestSequence).then((ar) => {
let record;
if (template == null){
reply.triggerError(new AsyncException(ErrorType.Management, ExceptionCode.TemplateNotFound, "Template not found for record."));
return;
}
if (template.definedType != null) {
record = new template.definedType();
} else {
} else if (template != null) {
record = new Record();
}
@ -189,23 +194,14 @@ export default class DataDeserializer {
if (template != null) {
initRecord(template);
} else {
if (connection == null)
throw Error("Can't parse record with no connection");
} else if (connection != null){
connection.getTemplate(classId).then((tmp) => {
if (tmp == null)
{
reply.triggerError(new AsyncException(
ErrorType.Management,
ExceptionCode.TemplateNotFound.index,
"Template not found for record."));
} else {
initRecord(tmp);
}
}).error((x) => reply.triggerError(x));
}
else {
initRecord(null);
}
return reply;
}