Skip to content

Instantly share code, notes, and snippets.

@davisp
Created March 28, 2016 17:06
Show Gist options
  • Select an option

  • Save davisp/708f08e5235e44f427e6 to your computer and use it in GitHub Desktop.

Select an option

Save davisp/708f08e5235e44f427e6 to your computer and use it in GitHub Desktop.
all: compile
compile:
c++ -std=c++11 -I/usr/local/include -L/usr/local/lib -ltks -ltsp -o toadtest toadtest.cc
run:
./toadtest
destroy:
/home/davisp/build/bin/cleantoaddisk all
#include <stdio.h>
#include <tks.h>
#include <tks_iterator.h>
#include <tks_exception.h>
int
main(int argc, char* argv[])
{
toad::access a;
toad::access b;
try {
a.shard_create("foo");
} catch(toad::error::null_pointer &e) {
fprintf(stderr, "NULL pointer for create shard\n");
} catch(toad::error::prep_container_create &e) {
fprintf(stderr, "prep_container_create\n");
} catch(toad::error::container_create &e) {
fprintf(stderr, "container_create\n");
} catch(std::exception &e) {
fprintf(stderr, "STD: %s\n", e.what());
} catch(...) {
fprintf(stderr, "unknown error\n");
}
try {
b.shard_create("foo");
} catch(toad::error::null_pointer &e) {
fprintf(stderr, "NULL pointer for create shard\n");
} catch(toad::error::prep_container_create &e) {
fprintf(stderr, "prep_container_create\n");
} catch(toad::error::container_create &e) {
fprintf(stderr, "container_create\n");
} catch(std::exception &e) {
fprintf(stderr, "STD: %s\n", e.what());
} catch(...) {
fprintf(stderr, "unknown error\n");
}
fprintf(stderr, "Created shard \"foo\"\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment