mirror of
https://github.com/esiur/esiur-js.git
synced 2025-05-06 12:32:58 +00:00
RecordParser
This commit is contained in:
parent
dcc33d7394
commit
10aa5d2a22
@ -172,9 +172,14 @@ export default class DataDeserializer {
|
|||||||
DataDeserializer.listParser(data, offset, length, connection, requestSequence).then((ar) => {
|
DataDeserializer.listParser(data, offset, length, connection, requestSequence).then((ar) => {
|
||||||
let record;
|
let record;
|
||||||
|
|
||||||
|
if (template == null){
|
||||||
|
reply.triggerError(new AsyncException(ErrorType.Management, ExceptionCode.TemplateNotFound, "Template not found for record."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (template.definedType != null) {
|
if (template.definedType != null) {
|
||||||
record = new template.definedType();
|
record = new template.definedType();
|
||||||
} else {
|
} else if (template != null) {
|
||||||
record = new Record();
|
record = new Record();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,23 +194,14 @@ export default class DataDeserializer {
|
|||||||
|
|
||||||
if (template != null) {
|
if (template != null) {
|
||||||
initRecord(template);
|
initRecord(template);
|
||||||
} else {
|
} else if (connection != null){
|
||||||
if (connection == null)
|
|
||||||
throw Error("Can't parse record with no connection");
|
|
||||||
|
|
||||||
connection.getTemplate(classId).then((tmp) => {
|
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);
|
initRecord(tmp);
|
||||||
}
|
|
||||||
|
|
||||||
}).error((x) => reply.triggerError(x));
|
}).error((x) => reply.triggerError(x));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
initRecord(null);
|
||||||
|
}
|
||||||
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user