Skip to content

Conversation

@Dzejkop
Copy link
Contributor

@Dzejkop Dzejkop commented Sep 7, 2018

No description provided.

@Dzejkop Dzejkop added the v3.x.x label Sep 7, 2018
@Dzejkop Dzejkop self-assigned this Sep 7, 2018
@Dzejkop Dzejkop requested review from genail and witcher112 September 7, 2018 11:04
timeCreated: 1536066842
licenseType: Free
DefaultImporter:
userData:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git reports this change as moving file, instead of changing it's content.


public AppVersion GetAppVersionInfo(int versionId)
{
if (versionId < 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I remember, version id cannot be zero. @genail am I right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most probably you're right. I can't recall any scenario where version is 0. When a version is not published, it just returns 404.

{
if (!string.IsNullOrEmpty(appVersion.MainExecutable))
{
return Path.Combine(_app.LocalDirectory.Path, appVersion.MainExecutable);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe check if that file exist before returning it as valid executable path?

That would be much more safe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Then report this incident to sentry and fallback to executable search.

Checking if API provided executable exists, otherwise reporting an exception to Sentry and falling back on executable search.

A valid version id should be larger than 0.

// Reports to Sentry
DebugLogger.LogException(
new FileNotFoundException(string.Format("Couldn't resolve executable in {0}", executablePath)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you create an exception you should always throw it. Otherwise stack trace information is not filled inside it.

So better solution for that would be to wrap this code inside try and report exception to Sentry in catch.

@witcher112 witcher112 merged commit eafb250 into dev/v3.x.x Nov 22, 2018
@witcher112 witcher112 deleted the feature/v3.x.x/1022-and-1021-app-version-process-info branch November 22, 2018 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants