|
2 | 2 | using Soenneker.Atomics.Bools; |
3 | 3 | using Soenneker.Extensions.ValueTask; |
4 | 4 | using Soenneker.Utils.AsyncSingleton.Abstract; |
| 5 | +using Soenneker.Utils.AsyncSingleton.Constants; |
5 | 6 | using Soenneker.Utils.AsyncSingleton.Enums; |
6 | 7 | using System; |
7 | 8 | using System.Threading; |
@@ -109,32 +110,32 @@ private async ValueTask<T> GetInternal(CancellationToken cancellationToken, para |
109 | 110 | { |
110 | 111 | case InitializationType.AsyncObject: |
111 | 112 | return _asyncObjectFunc is null |
112 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 113 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
113 | 114 | : await _asyncObjectFunc(objects).NoSync(); |
114 | 115 |
|
115 | 116 | case InitializationType.AsyncObjectToken: |
116 | 117 | return _asyncObjectTokenFunc is null |
117 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 118 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
118 | 119 | : await _asyncObjectTokenFunc(cancellationToken, objects).NoSync(); |
119 | 120 |
|
120 | 121 | case InitializationType.Async: |
121 | 122 | return _asyncFunc is null |
122 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 123 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
123 | 124 | : await _asyncFunc().NoSync(); |
124 | 125 |
|
125 | 126 | case InitializationType.SyncObject: |
126 | 127 | return _objectFunc is null |
127 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 128 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
128 | 129 | : _objectFunc(objects); |
129 | 130 |
|
130 | 131 | case InitializationType.SyncObjectToken: |
131 | 132 | return _objectTokenFunc is null |
132 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 133 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
133 | 134 | : _objectTokenFunc(cancellationToken, objects); |
134 | 135 |
|
135 | 136 | case InitializationType.Sync: |
136 | 137 | return _func is null |
137 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 138 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
138 | 139 | : _func(); |
139 | 140 |
|
140 | 141 | default: |
@@ -170,32 +171,32 @@ private T GetSyncInternal(params object[] objects) |
170 | 171 | { |
171 | 172 | case InitializationType.AsyncObject: |
172 | 173 | return _asyncObjectFunc is null |
173 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 174 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
174 | 175 | : _asyncObjectFunc(objects).AwaitSync(); |
175 | 176 |
|
176 | 177 | case InitializationType.AsyncObjectToken: |
177 | 178 | return _asyncObjectTokenFunc is null |
178 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 179 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
179 | 180 | : _asyncObjectTokenFunc(CancellationToken.None, objects).AwaitSync(); |
180 | 181 |
|
181 | 182 | case InitializationType.Async: |
182 | 183 | return _asyncFunc is null |
183 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 184 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
184 | 185 | : _asyncFunc().AwaitSync(); |
185 | 186 |
|
186 | 187 | case InitializationType.SyncObject: |
187 | 188 | return _objectFunc is null |
188 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 189 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
189 | 190 | : _objectFunc(objects); |
190 | 191 |
|
191 | 192 | case InitializationType.SyncObjectToken: |
192 | 193 | return _objectTokenFunc is null |
193 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 194 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
194 | 195 | : _objectTokenFunc(CancellationToken.None, objects); |
195 | 196 |
|
196 | 197 | case InitializationType.Sync: |
197 | 198 | return _func is null |
198 | | - ? throw new NullReferenceException(Constants.InitializationFuncError) |
| 199 | + ? throw new NullReferenceException(AsyncSingletonConstants.InitializationFuncError) |
199 | 200 | : _func(); |
200 | 201 |
|
201 | 202 | default: |
|
0 commit comments