Caught the lock_error as a const reference

should not catch exceptions by value