Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle nif loading failure #16

Merged
merged 2 commits into from Mar 13, 2019

Conversation

sparta-developers
Copy link

When Matrex has a problem loading the NIF, the entire application crashes because of the failed pattern match for :ok.

These changes allow the Erlang VM to start with a warning if the NIF fails to load. Once the application loads, calls to Matrex will then fail in the expected manner:

iex(application@127.0.0.1)6> Matrex.random(1000)
** (ErlangError) Erlang error: :nif_library_not_loaded
    :erlang.nif_error(:nif_library_not_loaded)
    (matrex) lib/matrex/nifs.ex:220: Matrex.NIFs.random/2
    (matrex) lib/matrex.ex:1903: Matrex.random/1

@coveralls
Copy link

Pull Request Test Coverage Report for Build 326

  • 2 of 4 (50.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 77.642%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/matrex/nifs.ex 1 2 50.0%
lib/matrex/threaded.ex 1 2 50.0%
Totals Coverage Status
Change from base Build 325: -0.2%
Covered Lines: 507
Relevant Lines: 653

💛 - Coveralls

@versilov versilov merged commit 172789d into versilov:master Mar 13, 2019
@versilov
Copy link
Owner

Thanks!

elcritch added a commit to elcritch/matrex that referenced this pull request Jan 7, 2020
# This is the 1st commit message:

porting numerix stats libraries

# This is the commit message versilov#2:

adding power function

# This is the commit message versilov#3:

fixing power

# This is the commit message versilov#4:

porting statistics

# This is the commit message versilov#5:

porting over statistics

# This is the commit message versilov#6:

fix apply

# This is the commit message versilov#7:

fix algos

# This is the commit message versilov#8:

fixing algos

# This is the commit message versilov#9:

test

# This is the commit message versilov#10:

updating stats test

# This is the commit message versilov#11:

switch type to matrex

# This is the commit message versilov#12:

fixing more tests

# This is the commit message versilov#13:

matrex

# This is the commit message versilov#14:

updates

# This is the commit message versilov#15:

removing experiment

# This is the commit message versilov#16:

try as row matrix by def

# This is the commit message versilov#17:

add vector pattern match

# This is the commit message versilov#18:

adding pseudo-vector type

# This is the commit message versilov#19:

fix order for column-wise vector

# This is the commit message versilov#20:

fix order for column-wise vector

# This is the commit message versilov#21:

fix order for column-wise vector

# This is the commit message versilov#22:

removing extras deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants