Skip to content

Conversation

@MaggieKimani1
Copy link
Contributor

@MaggieKimani1 MaggieKimani1 commented Aug 1, 2022

Resolves #888
Should fix #900

Comment on lines +61 to +70
catch (Exception ex)
{
#if DEBUG
logger.LogCritical(ex, ex.Message);
throw; // so debug tools go straight to the source of the exception when attached
#else
logger.LogCritical( ex.Message);
return 1;
#endif
}

Check notice

Code scanning / CodeQL

Generic catch clause

Generic catch clause.
Comment on lines 36 to 46
catch (Exception ex)
{
#if DEBUG
logger.LogCritical(ex, ex.Message);
throw; // so debug tools go straight to the source of the exception when attached
#else
logger.LogCritical( ex.Message);
Environment.Exit(1);
return 1;
#endif
}

Check notice

Code scanning / CodeQL

Generic catch clause

Generic catch clause.
Comment on lines 215 to +218
{
#if DEBUG
logger.LogCritical(ex, ex.Message);
#else
logger.LogCritical(ex.Message);

#endif
return 1;
}
throw new InvalidOperationException($"Could not transform the document, reason: {ex.Message}", ex);
}
}

private static XslCompiledTransform GetFilterTransform()
{
XslCompiledTransform transform = new();
Assembly assembly = typeof(OpenApiService).GetTypeInfo().Assembly;
Stream xslt = assembly.GetManifestResourceStream("Microsoft.OpenApi.Hidi.CsdlFilter.xslt");
transform.Load(new XmlTextReader(new StreamReader(xslt)));
return transform;
}

private static Stream ApplyFilter(string csdl, string entitySetOrSingleton, XslCompiledTransform transform)
{
Stream stream;
StreamReader inputReader = new(csdl);
XmlReader inputXmlReader = XmlReader.Create(inputReader);
MemoryStream filteredStream = new();
StreamWriter writer = new(filteredStream);
XsltArgumentList args = new();
args.AddParam("entitySetOrSingleton", "", entitySetOrSingleton);
transform.Transform(inputXmlReader, args, writer);
stream = filteredStream;
return stream;
}

/// <summary>
/// Implementation of the validate command

Check notice

Code scanning / CodeQL

Generic catch clause

Generic catch clause.
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

Successfully merging this pull request may close these issues.

Hidi returns exit code 0 even when failing on mac

3 participants