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

Allow Api::Error to take a printf style format string so that useful error message can be constructed more easily #350

Closed
a-siva opened this issue Nov 4, 2011 · 2 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@a-siva
Copy link
Contributor

a-siva commented Nov 4, 2011

Index: /Users/benl/svn-work/dart/dart/runtime/vm/dart_api_impl.cc
===================================================================

--- /Users/benl/svn-work/dart/dart/runtime/vm/dart_api_impl.cc (revision 1149)
+++ /Users/benl/svn-work/dart/dart/runtime/vm/dart_api_impl.cc (working copy)
@@ -504,7 +504,9 @­@
  cls_name ^= param.raw();
  const Class& cls = Class::Handle(lib.LookupClass(cls_name));
  if (cls.IsNull()) {

  • return Api::Error("Specified class does not exist");
  • const char *classname;
  • Dart_StringToCString(name, &classname);
  • return Api::Error(classname);
      }
      return Api::NewLocalHandle(cls);
     }

I really wanted to make the error more heplful, but I couldn't figure
out how, mainly because if anything was wrong with the build, I didn't
get any diagnostics, just:

@turnidge
Copy link
Contributor

turnidge commented Nov 4, 2011

I agree. In fact, I had already added a TODO in dart_api.h regarding this:

DART_EXPORT Dart_Handle Dart_Error(const char* error);
// TODO(turnidge): Accept printf-style args here.


Added Accepted label.

@turnidge
Copy link
Contributor

Added Fixed label.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

2 participants