pylover/restfulpy

Unhandled exception

Closed this issue · 0 comments

Unhandled exception:

127.0.0.1 - - [26/Sep/2018 11:40:12] "METADATA /resources HTTP/1.1" 200 2701
Traceback (most recent call last):
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlite3.IntegrityError: NOT NULL constraint failed: resource.password

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/nanohttp/application.py", line 108, in __call__
    response_body = self.__root__(*remaining_paths)
  File "/home/carrene/workspace/restfulpy/restfulpy/controllers.py", line 21, in __call__
    return super().__call__(*remaining_paths)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/nanohttp/controllers.py", line 111, in __call__
    return self._serve_handler(handler, remaining_paths)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/nanohttp/controllers.py", line 105, in _serve_handler
    return handler(*remaining_paths, **kwargs)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/nanohttp/controllers.py", line 111, in __call__
    return self._serve_handler(handler, remaining_paths)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/nanohttp/controllers.py", line 105, in _serve_handler
    return handler(*remaining_paths, **kwargs)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/nanohttp/decorators.py", line 133, in wrapper
    result = func(*args, **kwargs)
  File "/home/carrene/workspace/restfulpy/restfulpy/orm/__init__.py", line 85, in wrapper
    DBSession.commit()
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/scoping.py", line 157, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 921, in commit
    self.transaction.commit()
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 461, in commit
    self._prepare_impl()
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 441, in _prepare_impl
    self.session.flush()
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2192, in flush
    self._flush(objects)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2312, in _flush
    transaction.rollback(_capture_exception=True)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
    raise value
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 2276, in _flush
    flush_context.execute()
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 389, in execute
    rec.execute(self)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 548, in execute
    uow
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
    mapper, table, insert)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 835, in _emit_insert_statements
    execute(statement, params)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) NOT NULL constraint failed: resource.password [SQL: 'INSERT INTO resource (created_at, modified_at, title, password) VALUES (?, ?, ?, ?)'] [parameters: ('2018-09-26 08:10:12.663634', None, 'CRUD', None)]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/home/carrene/.virtualenvs/restfulpy/lib/python3.6/site-packages/nanohttp/application.py", line 141, in __call__
    return self._handle_exception(ex, start_response)
  File "/home/carrene/workspace/restfulpy/restfulpy/application/__init__.py", line 51, in _handle_exception
    ex = SqlError(ex)
  File "/home/carrene/workspace/restfulpy/restfulpy/exceptions.py", line 24, in __init__
    super().__init__(self.map_exception(sqlalchemy_error))
  File "/home/carrene/workspace/restfulpy/restfulpy/exceptions.py", line 32, in map_exception
    error_code = ex.orig.pgcode
AttributeError: 'IntegrityError' object has no attribute 'pgcode'