You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "rbelavadi (via GitHub)" <gi...@apache.org> on 2026/07/10 21:19:43 UTC
[PR] test(frontend): add unit test coverage for extractErrorMessage [texera]
rbelavadi opened a new pull request, #6321:
URL: https://github.com/apache/texera/pull/6321
### What changes were proposed in this PR?
Adds `error.spec.ts` to cover `extractErrorMessage`, a previously untested pure utility function in `common/util/` that normalizes errors of unknown shape into a display-safe string. Covers all four behavior branches: a native `Error` instance, an object with a string `error` key, an object with a nested `{ error: { message } }` shape, and fallback behavior for unrecognized shapes (null, number, empty object, malformed error key).
No production code was changed.
### Any related issues, documentation, discussions?
Closes #6254
### How was this PR tested?
Added 7 new unit tests in error.spec.ts covering all branches described in the issue. Ran locally via `npx ng test --include='**/error.spec.ts'`; all 7 pass.
### Was this PR authored or co-authored using generative AI tooling?
No.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(frontend): add test coverage and null guard for extractErrorMessage [texera]
Posted by "xuang7 (via GitHub)" <gi...@apache.org>.
xuang7 merged PR #6321:
URL: https://github.com/apache/texera/pull/6321
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(frontend): add test coverage and null guard for extractErrorMessage [texera]
Posted by "rbelavadi (via GitHub)" <gi...@apache.org>.
rbelavadi commented on PR #6321:
URL: https://github.com/apache/texera/pull/6321#issuecomment-4962386969
@xuang7 title and description have been updated!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): add unit test coverage for extractErrorMessage [texera]
Posted by "rbelavadi (via GitHub)" <gi...@apache.org>.
rbelavadi commented on PR #6321:
URL: https://github.com/apache/texera/pull/6321#issuecomment-4939632718
/request-review @xuang7
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(frontend): add test coverage and null guard for extractErrorMessage [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #6321:
URL: https://github.com/apache/texera/pull/6321#issuecomment-4972940198
Backport to [`release/v1.2`](https://github.com/apache/texera/tree/release/v1.2) succeeded as [`939ae30`](https://github.com/apache/texera/commit/939ae30e265036cc9e677f9458955ea2d8a11187). [Run](https://github.com/apache/texera/actions/runs/29360470196)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): add unit test coverage for extractErrorMessage [texera]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #6321:
URL: https://github.com/apache/texera/pull/6321#discussion_r3562246021
##########
frontend/src/app/common/util/error.spec.ts:
##########
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { extractErrorMessage } from "./error";
+
+describe("extractErrorMessage", () => {
+ it("should return the message from an Error instance", () => {
+ const testError = new Error("error instance");
+ const result = extractErrorMessage(testError);
+ expect(result).toBe(testError.message);
+ });
+
+ it("should return the error string when error is a plain string", () => {
+ const testError = { error: "boom" };
+ const result = extractErrorMessage(testError);
+ expect(result).toBe(testError.error);
+ });
+
+ it("should return the nested message when error is an object with a message", () => {
+ const testError = { error: { message: "nested" } };
+ const result = extractErrorMessage(testError);
+ expect(result).toBe(testError.error.message);
+ });
Review Comment:
`extractErrorMessage` currently throws for inputs like `{ error: null }` because `typeof null === "object"` and the implementation uses `'message' in backendErr` without a null check. Since this helper is used in UI error reporting, it should never throw; please add a regression test for `{ error: null }` (and ideally `{ error: { message: 123 } }`) and update the implementation to guard `backendErr !== null` (and ensure `message` is a string) before returning it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): add unit test coverage for extractErrorMessage [texera]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #6321:
URL: https://github.com/apache/texera/pull/6321#issuecomment-4939636962
### :warning: JUnit XML file not found
The CLI was unable to find any JUnit XML files to upload.
For more help, visit our [troubleshooting guide](https://docs.codecov.com/docs/test-analytics#troubleshooting).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): add unit test coverage for extractErrorMessage [texera]
Posted by "rbelavadi (via GitHub)" <gi...@apache.org>.
rbelavadi commented on PR #6321:
URL: https://github.com/apache/texera/pull/6321#issuecomment-4960332416
@xuang7 changes are complete.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(frontend): add test coverage and null guard for extractErrorMessage [texera]
Posted by "rbelavadi (via GitHub)" <gi...@apache.org>.
rbelavadi commented on code in PR #6321:
URL: https://github.com/apache/texera/pull/6321#discussion_r3581772567
##########
frontend/src/app/common/util/error.spec.ts:
##########
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { extractErrorMessage } from "./error";
+
+describe("extractErrorMessage", () => {
+ it("should return the message from an Error instance", () => {
+ const testError = new Error("error instance");
+ const result = extractErrorMessage(testError);
+ expect(result).toBe(testError.message);
+ });
+
+ it("should return the error string when error is a plain string", () => {
+ const testError = { error: "boom" };
+ const result = extractErrorMessage(testError);
+ expect(result).toBe(testError.error);
+ });
+
+ it("should return the nested message when error is an object with a message", () => {
+ const testError = { error: { message: "nested" } };
+ const result = extractErrorMessage(testError);
+ expect(result).toBe(testError.error.message);
+ });
Review Comment:
Added a case for `{ error: null }`. Also updated the implementation of error.ts to include the guard `backendErr !== null`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(frontend): add unit test coverage for extractErrorMessage [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #6321:
URL: https://github.com/apache/texera/pull/6321#issuecomment-4939626254
<!-- texera-reviewer-suggestion -->
### Automated Reviewer Suggestions
Based on the `git blame` history of the changed files, we recommend the following reviewers:
- No candidates found from `git blame` history.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org