Skip to content
This repository was archived by the owner on Jan 1, 2025. It is now read-only.

Refine - extend the failure message of union() and or() with each branch failure messages #1961

Closed

Conversation

sompylasar
Copy link

Summary:
The union() and or() checkers were hiding the underlying failure messages, so it was difficult to understand from the message alone what exactly could be failing.

This change surfaces the underlying failure messages to the failure message of the whole union.

Failing check Message before Message after
or(string(), number())(true) value did not match any types in or() value did not match any types in or(): value is not a string, value is not a number
union(string(), number())(true) value did not match any types in union value did not match any types in union: value is not a string, value is not a number

Reviewed By: bsouthga

Differential Revision: D38772695

… branch failure messages

Summary:
The `union()` and `or()` checkers were hiding the underlying failure messages, so it was difficult to understand from the message alone what exactly could be failing.

This change surfaces the underlying failure messages to the failure message of the whole union.

| Failing check | Message before | Message after |
| ------- | ------ | ----- |
| `or(string(), number())(true)` | `value did not match any types in or()` | `value did not match any types in or(): value is not a string, value is not a number` |
| `union(string(), number())(true)` | `value did not match any types in union` | `value did not match any types in union: value is not a string, value is not a number` |

Reviewed By: bsouthga

Differential Revision: D38772695

fbshipit-source-id: b27539516510802c3eb0aaaa7898337193f942db
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Aug 17, 2022
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D38772695

@drarmstr drarmstr added the Component: refine related to refine label Aug 17, 2022
drarmstr pushed a commit to drarmstr/Recoil that referenced this pull request Aug 17, 2022
… branch failure messages (facebookexperimental#1961)

Summary:
Pull Request resolved: facebookexperimental#1961

The `union()` and `or()` checkers were hiding the underlying failure messages, so it was difficult to understand from the message alone what exactly could be failing.

This change surfaces the underlying failure messages to the failure message of the whole union.

| Failing check | Message before | Message after |
| ------- | ------ | ----- |
| `or(string(), number())(true)` | `value did not match any types in or()` | `value did not match any types in or(): value is not a string, value is not a number` |
| `union(string(), number())(true)` | `value did not match any types in union` | `value did not match any types in union: value is not a string, value is not a number` |

Reviewed By: drarmstr, bsouthga

Differential Revision: D38772695

fbshipit-source-id: a047ec63ed71acd021cd7c83733f9620b1e22a1c
@drarmstr drarmstr mentioned this pull request Aug 17, 2022
facebook-github-bot pushed a commit that referenced this pull request Aug 18, 2022
Summary:
Pull Request resolved: #1959

Refine 0.1.1 release:

- Rename `boolean()` export to `bool()` since `boolean` is a reserved word (#1922, #1962)
- Remove reference to `native` directory in `package.json` to cleanup errors for `react-native`. (#1931)
- Export `Path` class for custom checkers. (#1950, #1956)
- Extend the failure message of `union()` and `or()` with each type. (#1961)

Reviewed By: bsouthga

Differential Revision: D38764896

fbshipit-source-id: 5eb0327ab9034f3f0802796d986fd6e7df28f05c
snipershooter0701 pushed a commit to snipershooter0701/Recoil that referenced this pull request Mar 5, 2023
… branch failure messages (#1961)

Summary:
Pull Request resolved: facebookexperimental/Recoil#1961

The `union()` and `or()` checkers were hiding the underlying failure messages, so it was difficult to understand from the message alone what exactly could be failing.

This change surfaces the underlying failure messages to the failure message of the whole union.

| Failing check | Message before | Message after |
| ------- | ------ | ----- |
| `or(string(), number())(true)` | `value did not match any types in or()` | `value did not match any types in or(): value is not a string, value is not a number` |
| `union(string(), number())(true)` | `value did not match any types in union` | `value did not match any types in union: value is not a string, value is not a number` |

Reviewed By: drarmstr, bsouthga

Differential Revision: D38772695

fbshipit-source-id: ddd00c60480aeb18676ce98950e47c0f27ecadb4
eagle2722 added a commit to eagle2722/Recoil that referenced this pull request Sep 21, 2024
… branch failure messages (#1961)

Summary:
Pull Request resolved: facebookexperimental/Recoil#1961

The `union()` and `or()` checkers were hiding the underlying failure messages, so it was difficult to understand from the message alone what exactly could be failing.

This change surfaces the underlying failure messages to the failure message of the whole union.

| Failing check | Message before | Message after |
| ------- | ------ | ----- |
| `or(string(), number())(true)` | `value did not match any types in or()` | `value did not match any types in or(): value is not a string, value is not a number` |
| `union(string(), number())(true)` | `value did not match any types in union` | `value did not match any types in union: value is not a string, value is not a number` |

Reviewed By: drarmstr, bsouthga

Differential Revision: D38772695

fbshipit-source-id: ddd00c60480aeb18676ce98950e47c0f27ecadb4
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Component: refine related to refine fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants