lotus-model 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f21fa9e59f4e1cb1f1892e30557d39293abada84
4
- data.tar.gz: 10adc53a8de64a6b6ffbe17d99c62af5c9d37b16
3
+ metadata.gz: e991dd7e68e0f41b03ab108f7245fb27b0a0127d
4
+ data.tar.gz: 729d719cbfbb7f1fafa05d76ca3fd7354ab9dca3
5
5
  SHA512:
6
- metadata.gz: 9e2ccc8f6beac3d0fde6826d9f2a6c8d5eafc8084ce0cbc1e6d61e8be89d0ee6f909f0e7a2b9df30c2517d5d1a3f3470d0205379a8d42c670a3aed78f69836c5
7
- data.tar.gz: 55c49d4330fa045ace6a741ace5e4ad005c2aaa5680e1c1d5fcd11627f50829a5a5831f37948892a9c3834ea5b4f40d227896e830fd6b3bbc4396f9924c221ab
6
+ metadata.gz: 50a86645f4d9263ea03e243ae7bd410ea68130ccd7f953d37f72d8ca458726e2ef4f5a368e482e3e9271f53196003f532e412d29b5756d7604c5d7f922a58f76
7
+ data.tar.gz: 0c3d1fa8a8f143975ac3a2bcc23b1c7c86928503c8ee8fd41c815666dc2ea0bc023e289ad06a55d801a44794fd5ed7fba6becfcea3bf1c971819779f877f193d
@@ -1,6 +1,13 @@
1
1
  # Lotus::Model
2
2
  A persistence layer for Lotus
3
3
 
4
+ ## v0.5.2 - 2016-01-19
5
+ ### Changed
6
+ - [Sean Collins] Improved error message for `Lotus::Model::Adapters::NoAdapterError`
7
+
8
+ ### Fixed
9
+ - [Kyle Chong & Trung Lê] Catch Sequel exceptions and re-raise as `Lotus::Model::Error`
10
+
4
11
  ## v0.5.1 - 2016-01-12
5
12
  ### Added
6
13
  - [Taylor Finnell] Let `Lotus::Model::Configuration#adapter` to accept arbitrary options (eg. `adapter type: :sql, uri: 'jdbc:...', after_connect: Proc.new { |connection| connection.auto_commit(true) }`)
@@ -6,7 +6,9 @@ module Lotus
6
6
  # @since 0.2.0
7
7
  class NoAdapterError < Lotus::Model::Error
8
8
  def initialize(method_name)
9
- super("Cannot invoke `#{ method_name }' on repository. Please check if `adapter' and `mapping' are set.")
9
+ super("Cannot invoke `#{ method_name }' on repository. "\
10
+ "Please check if `adapter' and `mapping' are set, "\
11
+ "and that you call `.load!' on the configuration.")
10
12
  end
11
13
  end
12
14
 
@@ -31,6 +31,8 @@ module Lotus
31
31
  # @since 0.1.0
32
32
  def create(entity)
33
33
  @collection.insert(entity)
34
+ rescue Sequel::DatabaseError => e
35
+ raise Lotus::Model::Error.new(e.message)
34
36
  end
35
37
 
36
38
  # Updates the corresponding record for the given entity.
@@ -43,6 +45,8 @@ module Lotus
43
45
  # @since 0.1.0
44
46
  def update(entity)
45
47
  @collection.update(entity)
48
+ rescue Sequel::DatabaseError => e
49
+ raise Lotus::Model::Error.new(e.message)
46
50
  end
47
51
 
48
52
  # Deletes all the records for the current query.
@@ -56,6 +60,8 @@ module Lotus
56
60
  # @since 0.1.0
57
61
  def delete
58
62
  @collection.delete
63
+ rescue Sequel::DatabaseError => e
64
+ raise Lotus::Model::Error.new(e.message)
59
65
  end
60
66
 
61
67
  alias_method :clear, :delete
@@ -3,6 +3,6 @@ module Lotus
3
3
  # Defines the version
4
4
  #
5
5
  # @since 0.1.0
6
- VERSION = '0.5.1'.freeze
6
+ VERSION = '0.5.2'.freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lotus-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-01-12 00:00:00.000000000 Z
13
+ date: 2016-01-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: lotus-utils