Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper SensorException #1

Merged
merged 1 commit into from
Apr 8, 2015
Merged

Add proper SensorException #1

merged 1 commit into from
Apr 8, 2015

Conversation

aaaaalbert
Copy link
Contributor

Using raise without an argument causes an error in the Repy runtime that looks like this:

Uncaught exception!

---
Following is a full traceback, and a user traceback.
The user traceback excludes non-user modules. The most recent call is displayed last.

Full debugging traceback:
  "repyV2/repy.py", line 177, in execute_namespace_until_completion
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "location.r2py", line 66, in <module>
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/namespace.py", line 1220, in wrapped_function
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/namespace.py", line 218, in _handle_internalerror
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/tracebackrepy.py", line 209, in handle_internalerror
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 493, in exceptionraiser

User traceback:
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "location.r2py", line 66, in <module>

Unsafe call: ("Unsafe call '__import__' with args '('servicelogger', {'handle_internalerror': <function handle_internalerror at 0x40668130>, 

(followed by lots of definitions available in the function scope, etc.)

Patching as proposed in SeattleTestbed/repy_v2#92 (comment) shows what the actual problem is:

Something went wrong!

---
Uncaught exception!

---
Following is a full traceback, and a user traceback.
The user traceback excludes non-user modules. The most recent call is displayed last.

Full debugging traceback:
  "repyV2/repy.py", line 177, in execute_namespace_until_completion
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "location.r2py", line 53, in <module>
  "sensorlib.r2py", line 107, in request_data

User traceback:
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "location.r2py", line 53, in <module>
  "sensorlib.r2py", line 107, in request_data

Exception (with type 'exceptions.TypeError'): exceptions must be old-style classes or derived from BaseException, not NoneType

---

This commit fixes the complaint about exceptions, making the traceback look like this:

Uncaught exception!

---
Following is a full traceback, and a user traceback.
The user traceback excludes non-user modules. The most recent call is displayed last.

Full debugging traceback:
  "repyV2/repy.py", line 177, in execute_namespace_until_completion
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "location.r2py", line 53, in <module>
  "sensorlib.r2py", line 114, in request_data

User traceback:
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "location.r2py", line 53, in <module>
  "sensorlib.r2py", line 114, in request_data

Exception (with class '.SensorException'): java.io.IOException: Service not Available

---

Using `raise` without an argument causes an error in the Repy runtime that looks like this:
```
Uncaught exception!
---
Following is a full traceback, and a user traceback.
The user traceback excludes non-user modules. The most recent call is displayed last.

Full debugging traceback:
  "repyV2/repy.py", line 177, in execute_namespace_until_completion
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "location.r2py", line 66, in <module>
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/namespace.py", line 1220, in wrapped_function
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/namespace.py", line 218, in _handle_internalerror
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/tracebackrepy.py", line 209, in handle_internalerror
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 493, in exceptionraiser

User traceback:
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "location.r2py", line 66, in <module>

Unsafe call: ("Unsafe call '__import__' with args '('servicelogger', {'handle_internalerror': <function handle_internalerror at 0x40668130>, 
```
(followed by lots of definitions available in the function scope, etc.)

Patching as proposed in SeattleTestbed/repy_v2#92 (comment) shows what the actual problem is:
```
Something went wrong!
---
Uncaught exception!
---
Following is a full traceback, and a user traceback.
The user traceback excludes non-user modules. The most recent call is displayed last.

Full debugging traceback:
  "repyV2/repy.py", line 177, in execute_namespace_until_completion
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "location.r2py", line 53, in <module>
  "sensorlib.r2py", line 107, in request_data

User traceback:
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "location.r2py", line 53, in <module>
  "sensorlib.r2py", line 107, in request_data

Exception (with type 'exceptions.TypeError'): exceptions must be old-style classes or derived from BaseException, not NoneType
---
```

This commit fixes the complaint about exceptions, making the traceback look like this:
```
Uncaught exception!
---
Following is a full traceback, and a user traceback.
The user traceback excludes non-user modules. The most recent call is displayed last.

Full debugging traceback:
  "repyV2/repy.py", line 177, in execute_namespace_until_completion
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/virtual_namespace.py", line 117, in evaluate
  "/mnt/sdcard/Android/data/com.sensibility_testbed/files/sl4a/seattle/seattle_repy/repyV2/safe.py", line 588, in safe_run
  "location.r2py", line 53, in <module>
  "sensorlib.r2py", line 114, in request_data

User traceback:
  "dylink.r2py", line 547, in <module>
  "dylink.r2py", line 408, in dylink_dispatch
  "dylink.r2py", line 521, in evaluate
  "location.r2py", line 53, in <module>
  "sensorlib.r2py", line 114, in request_data

Exception (with class '.SensorException'): java.io.IOException: Service not Available
---
```
yyzhuang added a commit that referenced this pull request Apr 8, 2015
Add proper `SensorException`
@yyzhuang yyzhuang merged commit 94ca255 into SensibilityTestbed:master Apr 8, 2015
@yyzhuang
Copy link
Contributor

yyzhuang commented Apr 8, 2015

I didn't get an error like this. When you get time, could you open Eclipse and when this call is made, see what logcat says about this call (geocode)? https://github.com/SensibilityTestbed/sensorlib/blob/master/location.r2py#L51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants