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

Explicitly error if the category is not found #54

Closed
G-Rath opened this issue Jun 22, 2024 · 0 comments · Fixed by #56
Closed

Explicitly error if the category is not found #54

G-Rath opened this issue Jun 22, 2024 · 0 comments · Fixed by #56
Assignees
Labels
bug Something isn't working

Comments

@G-Rath
Copy link
Contributor

G-Rath commented Jun 22, 2024

Currently we always assume that the results include the category that was requested, but technically that's not the case - i.e. Lighthouse v12 removed the PWA category which we were using in an app, meaning it started erroring very generically due to trying to do nil * 100.

Lighthouse does not seem to validate the values passed which I've opened an issue for improving, but ultimately we should handle this gracefully too.

I've got a basic patch for this already:

  def category
    category = results.dig('categories', @audit.to_s)

    raise Error, "Category '#{@audit}' not found in Lighthouse results - maybe it was removed?" if category.nil?

    category
  end
@G-Rath G-Rath added the bug Something isn't working label Jun 22, 2024
@G-Rath G-Rath self-assigned this Jun 27, 2024
@G-Rath G-Rath closed this as completed in #56 Jul 5, 2024
@G-Rath G-Rath closed this as completed in 2fc315e Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant