Skip to content

Commit

Permalink
Refactored error message when no RAT.jl (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Aug 29, 2024
1 parent 1bc2c94 commit 0e45f73
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.15.15] 29/08/2024

### Changed

* Refactored error message code when `ProductManifold` is used without `RecursiveArrayTools.jl`.

## [0.15.14] 27/08/2024

### Added
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ManifoldsBase"
uuid = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"
authors = ["Seth Axen <[email protected]>", "Mateusz Baran <[email protected]>", "Ronny Bergmann <[email protected]>", "Antoine Levitt <[email protected]>"]
version = "0.15.14"
version = "0.15.15"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
19 changes: 11 additions & 8 deletions src/ManifoldsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,18 @@ end
@inline function allocate_result(M::AbstractManifold, f)
T = allocate_result_type(M, f, ())
rs = representation_size(M)
if isnothing(rs)
msg = "Could not allocate result of function $f on manifold $M."
if M isa ProductManifold
msg *= " This error could be resolved by importing RecursiveArrayTools.jl. If this is not the case, please open report an issue."
end
error(msg)
else
return Array{T}(undef, rs...)
return allocate_result_array(M, f, T, rs)
end

function allocate_result_array(M::AbstractManifold, f, ::Type, ::Nothing)
msg = "Could not allocate result of function $f on manifold $M."
if base_manifold(M) isa ProductManifold
msg *= " This error could be resolved by importing RecursiveArrayTools.jl. If this is not the case, please open report an issue."
end
return error(msg)
end
function allocate_result_array(::AbstractManifold, f, T::Type, rs::Tuple)
return Array{T}(undef, rs...)
end

"""
Expand Down

2 comments on commit 0e45f73

@mateuszbaran
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/114082

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.15.15 -m "<description of version>" 0e45f73b1f35ff4fa4ee34967495eab11e3e2902
git push origin v0.15.15

Please sign in to comment.