Skip to content

Commit 6193038

Browse files
authored
Merge pull request #113 from khalidkhankakar/fix-error-reporting-1
Improve Error Reporting for Text Fragment Generation (#71)
2 parents 84c592c + 6b2b585 commit 6193038

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

content_script.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
((browser) => {
17+
1718
let DEBUG = false;
1819

1920
const log = (...args) => {
@@ -47,7 +48,7 @@
4748
return url;
4849
} else {
4950
reportFailure(result.status);
50-
return `Could not create URL ${result.status}`;
51+
return `Oops! Unable to create link. ${result.status}`;
5152
}
5253
};
5354

@@ -71,11 +72,10 @@
7172

7273
const reportFailure = (status) => {
7374
const statusCodes = {
74-
1: 'INVALID_SELECTION: The selection provided could not be used.',
75-
76-
2: 'AMBIGUOUS: No unique fragment could be identified for this selection.',
77-
3: 'TIMEOUT: Computation could not complete in time.',
78-
4: 'EXECUTION_FAILED: Unknown error.',
75+
1: 'INVALID_SELECTION: ❌ The selected text is too short or does not contain enough valid words. Please choose a longer or more specific phrase.',
76+
2: 'AMBIGUOUS:❌ The selected text appears multiple times on this page and no unique link could be created. Try selecting a different text segment.',
77+
3: 'TIMEOUT: ⏳ The process took too long. This may be due to a large page size or slow browser performance. Try selecting a different text segment.',
78+
4: 'EXECUTION_FAILED: ⚠️ An unexpected error occurred while generating the link.
7979
};
8080

8181
window.queueMicrotask(() => {

0 commit comments

Comments
 (0)