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

Added basic error handling to data fetch in emissions script #221

Merged

Conversation

dsubject
Copy link

Triage

Type of change

Please select any of the below items that are appropriate.

This pull request:

  • Adds a new carbon estimation model to CO2.js
  • Adds new functionality to an existing model
  • Fixes a bug with an existing model implementation
  • Add other new functionality to CO2.js
  • Add new data to CO2.js
  • Improves developer experience for contributors
  • Adds contributors to CO2.js
  • Does something not specified above

Related issue/s

Please list below any issues this pull request is related to.

Docs changes required

Do any changes made in this pull request require parts of the CO2.js documentation to be updated?

  • Yes
  • No
  • I don't know

If you answered "Yes", please create an corresponding issue in our Developer Documentation repository.

Describe the changes made in this pull request

As clearly as possible, describe the changes made in the pull request. You should at least detail "what changes have been made" and "what the results of these changes will be".

This pull request adds error handling to the script that generates average CO2 emissions data for each country. The changes made are as follows:

  • Added a try-catch block around the fetch request to handle network errors and log appropriate messages
  • Ensured that necessary directories (data/output and src/data) are created before attempting to write files to prevent runtime errors
  • These changes improve the robustness and reliability of the script, making it more resilient to failures and easier to debug for developers

danisubject and others added 3 commits July 19, 2024 11:06
commit 668d8e4
Merge: 33c66d7 21a1a25
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 10:15:46 2024 +0200

    Add JSDoc comments to data generation scripts and output files

commit 21a1a25
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 16:11:01 2024 +0800

    add comments to output of generators

commit cab18cf
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Oct 23 16:05:24 2024 +0800

    add comments about constants in source files

commit 33c66d7
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Mon Oct 14 15:46:00 2024 +0800

    add note about commenting

commit 5e58971
Author: Malay Kumar <malaykumar2003@gmail.com>
Date:   Sat Oct 12 19:01:39 2024 +0530

    Add JsDoc comments to marginal-intensities-2021

commit 6b000a0
Author: Malay Kumar <malaykumar2003@gmail.com>
Date:   Sat Oct 12 19:01:19 2024 +0530

    Add JsDoc comments to average-intensities

commit 29b6755
Author: Malay Kumar <malaykumar2003@gmail.com>
Date:   Sat Oct 12 18:59:08 2024 +0530

    Add JsDoc comments to generate_marginal_co2

commit eb4e9ff
Author: Malay Kumar <malaykumar2003@gmail.com>
Date:   Sat Oct 12 18:58:53 2024 +0530

    Add JsDoc comments to generate_average_co2

commit c238d96
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Sep 11 10:30:41 2024 +0800

    v0.16.1

commit d5d3156
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:44:34 2024 +0800

    0.16.1

commit 4b10930
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:43:51 2024 +0800

    v0.16.1

commit 8339284
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:38:33 2024 +0800

    update jsr export

commit 6c0f991
Merge: 8f9097c ed2d8ab
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:35:05 2024 +0800

    Add basic JSR support

commit ed2d8ab
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:20:27 2024 +0800

    update average grid intensities

commit 8f9097c
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:17:29 2024 +0800

    update test constants

commit ce1ada5
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:11:41 2024 +0800

    update version

commit 2962ca1
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:06:52 2024 +0800

    create hosting module

commit 2dd34ec
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Tue Sep 10 15:03:33 2024 +0800

    add mod.ts for jsr

commit 870e621
Merge: 7adac52 87d0e62
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Fri Sep 6 14:35:09 2024 +0800

    [AUTOMATED] Update average annual grid intensities

commit 87d0e62
Author: fershad <fershad@users.noreply.github.com>
Date:   Tue Sep 3 10:10:55 2024 +0000

    Update average annual grid intensities

commit 7adac52
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Aug 21 12:55:39 2024 +0800

    update test constant

commit 344a513
Merge: 4541319 d080a36
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Aug 14 21:36:04 2024 +0200

    [AUTOMATED] Update average annual grid intensities

commit d080a36
Author: fershad <fershad@users.noreply.github.com>
Date:   Sat Aug 3 10:09:23 2024 +0000

    Update average annual grid intensities

commit 4541319
Merge: 8f95399 c19da59
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Wed Jul 31 22:38:58 2024 +0200

    Export classes inside of the individual models

commit c19da59
Author: fershad <27988517+fershad@users.noreply.github.com>
Date:   Thu Jul 11 22:02:57 2024 +0100

    export classes inside of the CO2 class
@fershad
Copy link
Contributor

fershad commented Oct 23, 2024

@danisubject thanks for this contribution, sorry it took so long to get it merged.

@fershad fershad merged commit e6847e5 into thegreenwebfoundation:main Oct 23, 2024
3 checks passed
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.

3 participants