Improve the error report

Throwing a string causes missing error stack, this PR makes these error strings be TypeErrors to address this issue.

This is an imported pull request from
https://github.com/google/skia/pull/156

GitOrigin-RevId: 3e2efca7c7b3c7e4780a08126d885f5ee949e722
Change-Id: I712f8ca5628a388486a5fefdfa784cfec69e2603
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/805207
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
2 files changed