Commit f1e4f89e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3ebe99a6
......@@ -37,8 +37,8 @@ using namespace golang;
// io::
namespace io {
const error EOF_ = fmt::errorf("EOF");
const error ErrUnexpectedEOF = fmt::errorf("unexpected EOF");
const error EOF_ = error::New("EOF");
const error ErrUnexpectedEOF = error::New("unexpected EOF");
} // io::
......@@ -182,19 +182,17 @@ string sprintf(const char *format, ...) {
}
error errorf(const string &format, ...) {
error err;
va_list argp;
va_start(argp, format);
err.err = fmt::sprintf(format.c_str(), argp);
error err = error::New(fmt::sprintf(format.c_str(), argp));
va_end(argp);
return err;
}
error errorf(const char *format, ...) {
error err;
va_list argp;
va_start(argp, format);
err.err = fmt::sprintf(format, argp);
error err = error::New(fmt::sprintf(format, argp));
va_end(argp);
return err;
}
......@@ -233,8 +231,8 @@ vector<string> split(const string &s, char sep) {
// context::
namespace context {
const error canceled = fmt::errorf("context canceled");
const error deadlineExceeded = fmt::errorf("deadline exceeded");
const error canceled = error::New("context canceled");
const error deadlineExceeded = error::New("deadline exceeded");
struct _Background : Context {
chan<structZ> done() {
......
......@@ -74,6 +74,9 @@ public:
bool operator!=(const error &rhs) const {
return !(*this==rhs);
}
// New creats error with text
static error New(const string &text);
};
// io::
......
......@@ -26,9 +26,9 @@
#include <golang/libgolang.h>
using namespace golang;
#include "wcfs.h"
#include "wcfs_misc.h"
struct WCFS;
struct PinReq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment