8000 Better error messages · Issue #17 · Proskomma/proskomma-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Better error messages #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chrisvire opened this issue Apr 9, 2025 · 1 comment
Open

Better error messages #17

chrisvire opened this issue Apr 9, 2025 · 1 comment

Comments

@chrisvire
Copy link
Contributor

A user has a file that we are trying to add to Proskomma. We get this error:

/Users/hubbard/codereview/appbuilder-pwa/node_modules/proskomma-core/dist/index.js:53510
        callback(result);
        ^
Error: Adding document, likely not USFM? : data/books/C02/42MRKarab_HB.usfm
{"errors":[{"message":"Syntax Error: Expected Name, found String \"غَرَسَ رَجُلٌ كَرْمًا، وَسَيَّجَهُ وَحَفَرَ مِعْصَرَةً وَبَنَى بُرْجًا لِلْحِرَاسَةِ، ثُمَّ أَجَّرَهُ لِفَلاَّحِينَ وَسَافَرَ. \".","locations":[{"line":940,"column":48}]}]}
    at /Users/hubbard/codereview/appbuilder-pwa/convert/convertBooks.ts:709:27
    at SABProskomma.gqlQuery (/Users/hubbard/codereview/appbuilder-pwa/node_modules/proskomma-core/dist/index.js:53510:9)

Does line 940, column 48 refer to the input file? If I open the file in VSCode and search for the string in quotes, here is what I find:

Image

That text looks like it is on line 933, so it is close to 940?

It would be good to get some context (e.g. chapter, verse).

42MRKarab_HB.usfm.txt

@chrisvire
Copy link
Contributor Author

This specific issue is due to the three quote marks in the text and that we are adding content using gqlQuery syntax.

       pk.gqlQuery(
            `mutation {
                addDocument(
                    selectors: [
                        {key: "lang", value: "${context.lang}"}, 
                        {key: "abbr", value: "${context.bcId}"}
                    ], 
                    contentType: "${book.file.split('.').pop()}", 
                    content: """${content}""",
                    tags: [
                        "sections:${book.section}",
                        "testament:${book.testament}"
                    ]
                )
            }`, (r:any) => {
               // log if document added successfully
               ...
               // if the document is not added successfully, the response return ed by Proskomma includes an error message
              ...
              resolve();
            }

Mark suggested that we add documents to the docset like the functions in https://github.com/Proskomma/proskomma-core/blob/main/test/lib/load.cjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0