From fb6ac0e620408da4992bbaec2aa66076d2465d14 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Mon, 7 Dec 2020 19:09:11 -0800 Subject: [PATCH 1/9] Run CI on push / pull_request to master --- .github/workflows/ci.yml | 6 +++++- README.md | 1 + package.json | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2972ba..55efa3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ name: CI -on: push +on: + push: + branches: [master] + pull_request: + branches: [master] jobs: build: diff --git a/README.md b/README.md index 4eeea8c..4a07e97 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Latest release](http://img.shields.io/github/release/purescript/purescript-exceptions.svg)](https://github.com/purescript/purescript-exceptions/releases) [![Build status](https://github.com/purescript/purescript-exceptions/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/purescript-exceptions/actions?query=workflow%3ACI+branch%3Amaster) +[![Pursuit](https://pursuit.purescript.org/packages/purescript-exceptions/badge)](https://pursuit.purescript.org/packages/purescript-exceptions) Exception effects. diff --git a/package.json b/package.json index 9452364..1c67b54 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "build": "eslint src && pulp build -- --censor-lib --strict" }, "devDependencies": { - "eslint": "^4.19.1", + "eslint": "^7.15.0", "pulp": "^15.0.0", "purescript-psa": "^0.8.0", - "rimraf": "^2.6.2" + "rimraf": "^3.0.2" } } From 43048fc7ea3704d91c35421220ec7c01abbf28f0 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Sun, 10 Jan 2021 14:49:10 -0800 Subject: [PATCH 2/9] Generate changelog and add PR template (#38) * Add pull request template * Update CI in PS to v0.14.0-rc5 * Generate CHANGELOG.md file using notes from previous GH releases --- .github/PULL_REQUEST_TEMPLATE.md | 12 +++++ .github/workflows/ci.yml | 2 +- CHANGELOG.md | 85 ++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 CHANGELOG.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..4435abb --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,12 @@ +**Description of the change** + +Clearly and concisely describe the purpose of the pull request. If this PR relates to an existing issue or change proposal, please link to it. Include any other background context that would help reviewers understand the motivation for this PR. + +--- + +**Checklist:** + +- [ ] Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)") +- [ ] Linked any existing issues or proposals that this pull request should close +- [ ] Updated or added relevant documentation +- [ ] Added a test for the contribution (if applicable) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55efa3d..f4f44e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: - uses: purescript-contrib/setup-purescript@main with: - purescript: "0.14.0-rc3" + purescript: "0.14.0-rc5" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b0e3155 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,85 @@ +# Changelog + +Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v4.0.0](https://github.com/purescript/purescript-exceptions/releases/tag/v4.0.0) - 2018-05-23 + +Updated for PureScript 0.12 + +## [v3.1.0](https://github.com/purescript/purescript-exceptions/releases/tag/v3.1.0) - 2017-07-27 + +Add `name` function to extract the name of an `Error` (@KtorZ) + +## [v3.0.0](https://github.com/purescript/purescript-exceptions/releases/tag/v3.0.0) - 2017-03-26 + +- Updated for PureScript 0.11 +- The `err :: EXCEPTION` row entry has been corrected to `exception :: EXCEPTION` + +## [v2.0.0](https://github.com/purescript/purescript-exceptions/releases/tag/v2.0.0) - 2016-10-07 + +- Updated dependencies + +## [v1.0.0](https://github.com/purescript/purescript-exceptions/releases/tag/v1.0.0) - 2016-06-01 + +This release is intended for the PureScript 0.9.1 compiler and newer. + +**Note**: The v1.0.0 tag is not meant to indicate the library is “finished”, the core libraries are all being bumped to this for the 0.9 compiler release so as to use semver more correctly. + +## [v1.0.0-rc.1](https://github.com/purescript/purescript-exceptions/releases/tag/v1.0.0-rc.1) - 2016-03-16 + +- Release candidate for the psc 0.8+ core libraries + +## [v0.3.4](https://github.com/purescript/purescript-exceptions/releases/tag/v0.3.4) - 2015-12-23 + +- Add `stack` error message accessor (@hdgarrood) + +## [v0.3.3](https://github.com/purescript/purescript-exceptions/releases/tag/v0.3.3) - 2015-12-11 + +Add `throw` (@hdgarrood) + +## [v0.3.2](https://github.com/purescript/purescript-exceptions/releases/tag/v0.3.2) - 2015-11-20 + +- Removed unused import (@tfausak) + +## [v0.3.1](https://github.com/purescript/purescript-exceptions/releases/tag/v0.3.1) - 2015-11-13 + +Added `Unsafe` module (@hdgarrood) + +## [v0.3.0](https://github.com/purescript/purescript-exceptions/releases/tag/v0.3.0) - 2015-06-30 + +This release works with versions 0.7.\* of the PureScript compiler. It will not work with older versions. If you are using an older version, you should require an older, compatible version of this library. + +## [v0.3.0-rc.1](https://github.com/purescript/purescript-exceptions/releases/tag/v0.3.0-rc.1) - 2015-06-09 + +Initial release candidate of the library intended for the 0.7 compiler. + +## [v0.2.3](https://github.com/purescript/purescript-exceptions/releases/tag/v0.2.3) - 2015-03-20 + +Updated docs + +## [v0.2.2](https://github.com/purescript/purescript-exceptions/releases/tag/v0.2.2) - 2014-11-16 + +Improvements to FFI code (@davidchambers) + +## [v0.2.1](https://github.com/purescript/purescript-exceptions/releases/tag/v0.2.1) - 2014-09-04 + +Handle errors from other JS domains (@joneshf) + +## [v0.2.0](https://github.com/purescript/purescript-exceptions/releases/tag/v0.2.0) - 2014-08-07 + + + +## [v0.1.0](https://github.com/purescript/purescript-exceptions/releases/tag/v0.1.0) - 2014-04-25 + + + From d979fc389ffb37d6a72efadc9c5abb0f29e241d5 Mon Sep 17 00:00:00 2001 From: milesfrain Date: Mon, 18 Jan 2021 21:55:47 -0800 Subject: [PATCH 3/9] Changelog updates since v4.0.0 (#39) --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0e3155..0e0e20d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,17 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Added support for PureScript 0.14 and dropped support for all previous versions (#36) New features: Bugfixes: +- Fixed `catchException` example to use `Console.logShow` instead of `print` (#31) Other improvements: +- Migrated CI to GitHub Actions and updated installation instructions to use Spago (#37) +- Added a CHANGELOG.md file and pull request template (#38, #39) +- Removed unnecessary type variable from `try` docstring (#33) ## [v4.0.0](https://github.com/purescript/purescript-exceptions/releases/tag/v4.0.0) - 2018-05-23 From 410d0b8813592bda3c25028540eeb2cda312ddc9 Mon Sep 17 00:00:00 2001 From: Cyril Date: Fri, 26 Feb 2021 18:58:42 +0100 Subject: [PATCH 4/9] Prepare v5.0.0 release (#40) * Update CI to build with the latest version of the compiler * Update the bower repository URL to match the URL in the registry * Upgrade bower dependencies * Update the changelog --- .github/workflows/ci.yml | 2 -- CHANGELOG.md | 10 ++++++++++ bower.json | 10 +++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4f44e5..43d2897 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,6 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main - with: - purescript: "0.14.0-rc5" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e0e20d..9e2fbd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v5.0.0](https://github.com/purescript/purescript-exceptions/releases/tag/v5.0.0) - 2021-02-26 + Breaking changes: - Added support for PureScript 0.14 and dropped support for all previous versions (#36) diff --git a/bower.json b/bower.json index c7bd741..f9e0321 100644 --- a/bower.json +++ b/bower.json @@ -4,7 +4,7 @@ "license": "BSD-3-Clause", "repository": { "type": "git", - "url": "git://github.com/purescript/purescript-exceptions.git" + "url": "https://github.com/purescript/purescript-exceptions.git" }, "ignore": [ "**/.*", @@ -16,9 +16,9 @@ "package.json" ], "dependencies": { - "purescript-effect": "master", - "purescript-either": "master", - "purescript-maybe": "master", - "purescript-prelude": "master" + "purescript-effect": "^3.0.0", + "purescript-either": "^5.0.0", + "purescript-maybe": "^5.0.0", + "purescript-prelude": "^5.0.0" } } From 0a51ee847c5224f7ecd1b371ea2b8d94588cbfd2 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Mon, 14 Mar 2022 13:24:42 -0700 Subject: [PATCH 5/9] Update to v0.15.0 (#41) * Migrated FFI to ES modules via 'lebab' * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Update pulp to 16.0.0-0 and psa to 0.8.2 * Update Bower dependencies to master * Update .eslintrc.json to ES6 * Added changelog entry --- .eslintrc.json | 6 ++---- .github/workflows/ci.yml | 2 ++ CHANGELOG.md | 1 + bower.json | 8 ++++---- package.json | 4 ++-- src/Effect/Exception.js | 30 ++++++++++++++---------------- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 84cef4f..1c6afb9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,9 @@ { "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 6, + "sourceType": "module" }, "extends": "eslint:recommended", - "env": { - "commonjs": true - }, "rules": { "strict": [2, "global"], "block-scoped-var": 2, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43d2897..b6ebf3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v2 - uses: purescript-contrib/setup-purescript@main + with: + purescript: "unstable" - uses: actions/setup-node@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e2fbd2..92480b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] Breaking changes: +- Migrate FFI to ES modules (#41 by @JordanMartinez) New features: diff --git a/bower.json b/bower.json index f9e0321..a3e7994 100644 --- a/bower.json +++ b/bower.json @@ -16,9 +16,9 @@ "package.json" ], "dependencies": { - "purescript-effect": "^3.0.0", - "purescript-either": "^5.0.0", - "purescript-maybe": "^5.0.0", - "purescript-prelude": "^5.0.0" + "purescript-effect": "master", + "purescript-either": "master", + "purescript-maybe": "master", + "purescript-prelude": "master" } } diff --git a/package.json b/package.json index 1c67b54..4ea39f9 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ }, "devDependencies": { "eslint": "^7.15.0", - "pulp": "^15.0.0", - "purescript-psa": "^0.8.0", + "pulp": "16.0.0-0", + "purescript-psa": "^0.8.2", "rimraf": "^3.0.2" } } diff --git a/src/Effect/Exception.js b/src/Effect/Exception.js index a5aa8c4..40c0eee 100644 --- a/src/Effect/Exception.js +++ b/src/Effect/Exception.js @@ -1,36 +1,34 @@ -"use strict"; - -exports.showErrorImpl = function (err) { +export function showErrorImpl(err) { return err.stack || err.toString(); -}; +} -exports.error = function (msg) { +export function error(msg) { return new Error(msg); -}; +} -exports.message = function (e) { +export function message(e) { return e.message; -}; +} -exports.name = function (e) { +export function name(e) { return e.name || "Error"; -}; +} -exports.stackImpl = function (just) { +export function stackImpl(just) { return function (nothing) { return function (e) { return e.stack ? just(e.stack) : nothing; }; }; -}; +} -exports.throwException = function (e) { +export function throwException(e) { return function () { throw e; }; -}; +} -exports.catchException = function (c) { +export function catchException(c) { return function (t) { return function () { try { @@ -44,4 +42,4 @@ exports.catchException = function (c) { } }; }; -}; +} From afab3c07c820bb49b6c5be50049db46a964a6161 Mon Sep 17 00:00:00 2001 From: JordanMartinez Date: Wed, 27 Apr 2022 14:25:56 -0500 Subject: [PATCH 6/9] Prepare v6.0.0 release (1st PS 0.15.0-compatible release) (#42) * Update the bower dependencies * Update Node to 14 in CI * Update the changelog --- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 10 ++++++++++ bower.json | 8 ++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6ebf3a..c69237a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: with: purescript: "unstable" - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14.x" - name: Install dependencies run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 92480b5..723dd9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Notable changes to this project are documented in this file. The format is based ## [Unreleased] +Breaking changes: + +New features: + +Bugfixes: + +Other improvements: + +## [v6.0.0](https://github.com/purescript/purescript-exceptions/releases/tag/v6.0.0) - 2022-04-27 + Breaking changes: - Migrate FFI to ES modules (#41 by @JordanMartinez) diff --git a/bower.json b/bower.json index a3e7994..ab0b012 100644 --- a/bower.json +++ b/bower.json @@ -16,9 +16,9 @@ "package.json" ], "dependencies": { - "purescript-effect": "master", - "purescript-either": "master", - "purescript-maybe": "master", - "purescript-prelude": "master" + "purescript-effect": "^4.0.0", + "purescript-either": "^6.0.0", + "purescript-maybe": "^6.0.0", + "purescript-prelude": "^6.0.0" } } From e110d79b25c375ccd7c25be29ed5ac28de7c80ef Mon Sep 17 00:00:00 2001 From: Jantxu <77549848+sigma-andex@users.noreply.github.com> Date: Thu, 22 Dec 2022 22:24:00 +0000 Subject: [PATCH 7/9] Add errorWithCause constructor (#43) * Add errorWithCause constructor * Update changelog --- CHANGELOG.md | 1 + src/Effect/Exception.js | 6 ++++++ src/Effect/Exception.purs | 11 ++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 723dd9b..f16b013 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: New features: +- Add `errorWithCause` (#43 by @sigma-andex) Bugfixes: diff --git a/src/Effect/Exception.js b/src/Effect/Exception.js index 40c0eee..7a55947 100644 --- a/src/Effect/Exception.js +++ b/src/Effect/Exception.js @@ -6,6 +6,12 @@ export function error(msg) { return new Error(msg); } +export function errorWithCause(msg) { + return function(cause) { + return new Error(msg, { cause }); + }; +} + export function message(e) { return e.message; } diff --git a/src/Effect/Exception.purs b/src/Effect/Exception.purs index 89e1668..fe4cf17 100644 --- a/src/Effect/Exception.purs +++ b/src/Effect/Exception.purs @@ -3,15 +3,17 @@ module Effect.Exception ( Error + , catchException , error + , errorWithCause , message , name , stack - , throwException - , catchException , throw + , throwException , try - ) where + ) + where import Prelude @@ -31,6 +33,9 @@ foreign import showErrorImpl :: Error -> String -- | Create a JavaScript error, specifying a message foreign import error :: String -> Error +-- | Create a JavaScript error, specifying a message and a cause +foreign import errorWithCause :: String -> Error -> Error + -- | Get the error message from a JavaScript error foreign import message :: Error -> String From 57220fada6494428f37ae0462e6ad56cf2d011b9 Mon Sep 17 00:00:00 2001 From: Mahdi Seyedan Date: Sun, 30 Jun 2024 15:42:21 +0330 Subject: [PATCH 8/9] Add errorWithName constructor (#44) --- CHANGELOG.md | 1 + src/Effect/Exception.js | 8 ++++++++ src/Effect/Exception.purs | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f16b013..c8885dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Breaking changes: New features: - Add `errorWithCause` (#43 by @sigma-andex) +- Add `errorWithName` (#44 by @jedimahdi) Bugfixes: diff --git a/src/Effect/Exception.js b/src/Effect/Exception.js index 7a55947..5e7b9d9 100644 --- a/src/Effect/Exception.js +++ b/src/Effect/Exception.js @@ -12,6 +12,14 @@ export function errorWithCause(msg) { }; } +export function errorWithName(msg) { + return function(name) { + const e = new Error(msg); + e.name = name; + return e; + }; +} + export function message(e) { return e.message; } diff --git a/src/Effect/Exception.purs b/src/Effect/Exception.purs index fe4cf17..f4c1beb 100644 --- a/src/Effect/Exception.purs +++ b/src/Effect/Exception.purs @@ -6,6 +6,7 @@ module Effect.Exception , catchException , error , errorWithCause + , errorWithName , message , name , stack @@ -36,6 +37,9 @@ foreign import error :: String -> Error -- | Create a JavaScript error, specifying a message and a cause foreign import errorWithCause :: String -> Error -> Error +-- | Create a JavaScript error, specifying a message and a name +foreign import errorWithName :: String -> String -> Error + -- | Get the error message from a JavaScript error foreign import message :: Error -> String From 2cd09e7f95c268ca3752d09cc7e5625ed6f502ab Mon Sep 17 00:00:00 2001 From: Gary Burgess Date: Sun, 30 Jun 2024 13:13:01 +0100 Subject: [PATCH 9/9] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8885dd..03b5b86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,13 +7,17 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: New features: -- Add `errorWithCause` (#43 by @sigma-andex) -- Add `errorWithName` (#44 by @jedimahdi) Bugfixes: Other improvements: +## [v6.1.0](https://github.com/purescript/purescript-exceptions/releases/tag/v6.1.0) - 2024-06-30 + +New features: +- Add `errorWithCause` (#43 by @sigma-andex) +- Add `errorWithName` (#44 by @jedimahdi) + ## [v6.0.0](https://github.com/purescript/purescript-exceptions/releases/tag/v6.0.0) - 2022-04-27 Breaking changes: