refactor(lib): remove obsolete code
feat(lib, tests): add exceptions and raw for query and more test cases