Skip to content

Error with _host.GetAllProjects(true); #28

Description

@GeoDirk

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions