private bool Try(Action action, string message, bool isError) { try { action(); return(true); } catch (Exception e) { if (isError) { _logger.LogError(message); _logger.LogErrorFromException(e); } else { _logger.LogWarning(message); _logger.LogWarningFromException(e); } return(!isError); } }
/// <summary> /// Run loads assembly in <see cref="_assemblyPath"/> then: /// |> GetExportedTypes /// |> GetMethods /// |> Where method is SDK method /// |> Convert that to function.json /// |> Create folder \{functionName}\ /// |> Write \{functionName}\function.json /// /// This means that every <see cref="MethodInfo"/> will be N binding objects on <see cref="FunctionJsonSchema"/> /// Where N == total number of SDK attributes on the method parameters. /// </summary> internal bool TryRun() { try { this._functionNamesSet.Clear(); if (!_buildArtifactsLog.TryClearBuildArtifactsLog()) { _log.LogError("Unable to clean build artifacts file."); return(false); } CleanOutputPath(); CopyFunctionArtifacts(); return(TryGenerateFunctionJsons()); } catch (Exception e) { _log.LogErrorFromException(e); return(false); } }