From 1e1e6f56d24a0cd6a3b270dc794374df6c3c832f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 18 May 2020 14:23:58 -0400 Subject: catching --- org/meta_conf_make_meta.org | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'org/meta_conf_make_meta.org') diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index 61e702f..dbe3cc9 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -1096,7 +1096,7 @@ if (_struct_composite.meta.creator_author.empty) { } _struct_composite.meta.creator_author_arr = author_arr; _struct_composite.meta.creator_author = author_arr.join(", ").chomp.chomp; - _struct_composite.meta.creator_author_surname = authors_hash_arr["last"][0]; + _struct_composite.meta.creator_author_surname = (authors_hash_arr["last"].length > 0) ? authors_hash_arr["last"][0] : ""; string _author_name_last_first = authors_hash_arr["last_first"].join("; ").chomp.chomp; _struct_composite.meta.creator_author_surname_fn = (_author_name_last_first.length > 0) ? _author_name_last_first @@ -1845,7 +1845,7 @@ if (_struct_composite.meta.creator_author.empty) { } _struct_composite.meta.creator_author_arr = author_arr; _struct_composite.meta.creator_author = author_arr.join(", ").chomp.chomp; - _struct_composite.meta.creator_author_surname = authors_hash_arr["last"][0]; + _struct_composite.meta.creator_author_surname = (authors_hash_arr["last"].length > 0) ? authors_hash_arr["last"][0] : ""; string _author_name_last_first = authors_hash_arr["last_first"].join("; ").chomp.chomp; _struct_composite.meta.creator_author_surname_fn = (_author_name_last_first.length > 0) ? _author_name_last_first @@ -2092,13 +2092,18 @@ template configParseYAMLreturnSpineStruct() { if (_document_struct.content.length > 0) { try { _yaml = Loader.fromString(_document_struct.content).load(); - _make_and_meta_struct - = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _document_struct.filename); - } catch { + } catch (Throwable) { import std.stdio; writeln("ERROR failed to parse content as yaml: ", _document_struct.filename); // writeln(_document_struct.content); } + try { + _make_and_meta_struct + = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _document_struct.filename); + } catch (Throwable) { + import std.stdio; + writeln("ERROR failed to convert yaml to struct: ", _document_struct.filename); + } } return _make_and_meta_struct; } @@ -2139,8 +2144,7 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { writeln("ERROR failed to read document header, yaml header does not contain essential information related to title and author"); } return contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, "header"); - } catch { - import std.stdio; + } catch (Throwable) { writeln("ERROR failed to read document header, header not parsed as yaml: ", _manifested.src.filename); return _make_and_meta_struct; } -- cgit v1.2.3