[GH-ISSUE #1247] [Scripting] Better error message when missing the return in onRequest() and onResponse() #1242

Open
opened 2026-03-03 19:49:38 +03:00 by kerem · 1 comment
Owner

Originally created by @NghiaTranUIT on GitHub (May 25, 2022).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1247

Originally assigned to: @NghiaTranUIT on GitHub.

Description

If we execute this script:

func onRequest(context, url, request) {
    // No return here
}

We will get this unclear error:

❌Error: TypeError: undefined is not an object (evaluating 'newResponse.headers')

We should fix it.

Acceptance Criteria

  • Check this scenario and present the friendly error message 👍
Originally created by @NghiaTranUIT on GitHub (May 25, 2022). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1247 Originally assigned to: @NghiaTranUIT on GitHub. ### Description If we execute this script: ```js func onRequest(context, url, request) { // No return here } ``` We will get this unclear error: ``` ❌Error: TypeError: undefined is not an object (evaluating 'newResponse.headers') ``` We should fix it. ### Acceptance Criteria - Check this scenario and present the friendly error message 👍
Author
Owner
<!-- gh-comment-id:1140684655 --> @NghiaTranUIT commented on GitHub (May 30, 2022): Done: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.5.0_Friendly_error_message_when_missing_the_return_func.dmg
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1242
No description provided.