Skip to content
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

Error with _host.GetAllProjects(true); #28

Open
GeoDirk opened this issue Feb 23, 2023 · 2 comments
Open

Error with _host.GetAllProjects(true); #28

GeoDirk opened this issue Feb 23, 2023 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@GeoDirk
Copy link

GeoDirk commented Feb 23, 2023

So I'm running into an exception that I can't get around with the plugin. Using the following code:

                var projects = _host.GetAllProjects(true);
                foreach (var project in projects)
                {
                    try
                    {
                        var temp = project.Type;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        throw;
                    }
                }

The above normally works fine for most projects. But we have a user who has a Paratext project with the settings file of:

<ScriptureText>
  <TranslationInfo>GlobalAnthropologyNotes::</TranslationInfo>
  <Versification>4</Versification>
  <Name>GANed</Name>
  <Encoding>65001</Encoding>
  <Editable>T</Editable>
  <Language>English</Language>
  <DefaultFont>Cambria</DefaultFont>
  <DefaultFontSize>14</DefaultFontSize>
  <FileNamePrePart />
  <FileNamePostPart>GANed.SFM</FileNamePostPart>
  <FileNameBookNameForm>41MAT</FileNameBookNameForm>
  <StyleSheet>usfm.sty</StyleSheet>
  <MinParatextVersion>8.0.63.1</MinParatextVersion>
  <AssociatedLexicalProject />
  <FullName>Global Anthro Notes (edit)</FullName>
  <Copyright />
  <LanguageIsoCode>en:::</LanguageIsoCode>
  <NormalizationForm>NFC</NormalizationForm>
  <BiblicalTermsListSetting>Project:EPe1:ProjectBiblicalTerms.xml</BiblicalTermsListSetting>
  <AllowReadAccess>F</AllowReadAccess>
  <AllowSharingWithSLDR>F</AllowSharingWithSLDR>
  <EncodingConverter />
  <NeedsEnglishLanguageFix>No</NeedsEnglishLanguageFix>
  <NeedsPortugueseLanguageFix>No</NeedsPortugueseLanguageFix>
  <Guid>b0bb2a840333b52f197a610822a3f3bb2b441a55</Guid>
  <FontFeatures />
  <HtmlLanguage />
  <Naming PrePart="" PostPart="GANed.SFM" BookNameForm="41MAT" />
</ScriptureText>

When the loop reaches this project, the plugin throws a "ProjectType is unsupported: GlobalAnthropologyNotes" that I'm not able to catch with the try/catch{}. Maybe filter out those bad project types from the GetAllProjects() list?

@jwickberg
Copy link
Collaborator

jwickberg commented Mar 2, 2023 via email

@tombogle
Copy link
Collaborator

tombogle commented Mar 2, 2023 via email

@FoolRunning FoolRunning added bug Something isn't working enhancement New feature or request labels Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants